Skip to content

Commit

Permalink
Improve __repr__ on generated models
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Mar 7, 2022
1 parent 1ad25a6 commit 3890096
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hierarkey/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ class BaseHierarkeyStoreModel(models.Model):
key = models.CharField(max_length=255)
value = models.TextField()

def __repr__(self):
return '<{}: "{}"{}>'.format(
type(self).__name__,
self.key,
' on object {}'.format(self.object_id) if hasattr(self, 'object_id') else '',
)

class Meta:
abstract = True

Expand Down

0 comments on commit 3890096

Please sign in to comment.