forked from 00dani/lemoncurry
Add cats to the admin and give them a more useful string representation
This commit is contained in:
parent
8fdaad5367
commit
b63e2db584
2 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from .models import Entry, Syndication
|
||||
from .models import Cat, Entry, Syndication
|
||||
|
||||
|
||||
class SyndicationInline(admin.TabularInline):
|
||||
|
@ -16,4 +16,5 @@ class EntryAdmin(admin.ModelAdmin):
|
|||
)
|
||||
|
||||
|
||||
admin.site.register(Cat)
|
||||
admin.site.register(Entry, EntryAdmin)
|
||||
|
|
|
@ -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,))
|
||||
|
|
Loading…
Reference in a new issue