Skip to content

Commit

Permalink
order relations by subj/obj id (default)
Browse files Browse the repository at this point in the history
Not ideal, they should be ordered by the names instead.
  • Loading branch information
gythaogg committed Dec 12, 2024
1 parent 694d2ae commit 811e485
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apis_ontology/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,15 @@ class Meta:
abstract = True


def enforce_plural_name(sender, **kwargs):
def enforce_meta_attributes(sender, **kwargs):
if issubclass(sender, TibScholRelationMixin):
meta = sender._meta
# set verbose_name_plural to verbose_name
meta.verbose_name_plural = meta.verbose_name or sender.__name__.lower()
meta.ordering = ["subj_object_id", "obj_object_id"]


class_prepared.connect(enforce_plural_name)
class_prepared.connect(enforce_meta_attributes)


class PersonActiveAtPlace(TibScholRelationMixin):
Expand Down

0 comments on commit 811e485

Please sign in to comment.