Add cats to the admin and give them a more useful string representation

This commit is contained in:
Danielle McLean 2017-11-20 11:37:36 +11:00
parent 8fdaad5367
commit b63e2db584
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 5 additions and 1 deletions

View file

@ -28,6 +28,9 @@ class Cat(models.Model):
name = models.CharField(max_length=255, unique=True)
slug = models.CharField(max_length=255, unique=True)
def __str__(self):
return '#' + self.name
@property
def url(self):
return reverse('entries:cat', args=(self.slug,))