Skip to content

Commit

Permalink
Make model checks safer
Browse files Browse the repository at this point in the history
If the test database is not set up, this check used to crash when
running manage.py check.
  • Loading branch information
jacobtylerwalls committed Nov 19, 2024
1 parent 062488f commit 198ca98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arches/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ def save(self, *args, **kwargs):
@classmethod
def check(cls, **kwargs):
errors = super().check(**kwargs)
errors.extend(cls._check_publication_in_every_language())
if kwargs["databases"]:
errors.extend(cls._check_publication_in_every_language())
return errors

@classmethod
Expand Down Expand Up @@ -789,7 +790,8 @@ class Meta:
@classmethod
def check(cls, **kwargs):
errors = super().check(**kwargs)
errors.extend(cls._check_root_node())
if kwargs["databases"]:
errors.extend(cls._check_root_node())
return errors

@classmethod
Expand Down

0 comments on commit 198ca98

Please sign in to comment.