Skip to content

Commit

Permalink
feat(generic): add uri_set method to GenericModel
Browse files Browse the repository at this point in the history
  • Loading branch information
sennierer authored and b1rger committed Dec 20, 2024
1 parent f7d71ae commit 2066511
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apis_core/generic/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ def duplicate(self):
return newobj

duplicate.alters_data = True

def uri_set(self):
ct = ContentType.objects.get_for_model(self)
return (
ContentType.objects.get(app_label="apis_metainfo", model="uri")
.model_class()
.objects.filter(content_type=ct, object_id=self.id)
.all()
)

0 comments on commit 2066511

Please sign in to comment.