Skip to content

Commit

Permalink
feat(generic): add a repr dunder method to the GenericModel
Browse files Browse the repository at this point in the history
This method lets us print more meaningful debug messages without having
to add the ID to the str dunder method.
  • Loading branch information
b1rger committed Oct 24, 2024
1 parent a0f52bf commit e0b44aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis_core/generic/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@


class GenericModel:
def __repr__(self):
return super().__repr__() + f" (ID: {self.id})"

@classmethod
def get_listview_url(cls):
ct = ContentType.objects.get_for_model(cls)
Expand Down

0 comments on commit e0b44aa

Please sign in to comment.