Make some little quality-of-life improvements to the Django admin for my models
This commit is contained in:
parent
63b0ec45e9
commit
75ed4503c8
3 changed files with 9 additions and 2 deletions
|
@ -8,6 +8,9 @@ class SyndicationInline(admin.TabularInline):
|
|||
|
||||
|
||||
class EntryAdmin(admin.ModelAdmin):
|
||||
date_hierarchy = 'published'
|
||||
list_display = ('title', 'id', 'kind', 'published')
|
||||
list_filter = ('kind',)
|
||||
inlines = (
|
||||
SyndicationInline,
|
||||
)
|
||||
|
|
|
@ -3,6 +3,10 @@ from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|||
from .models import Key, Profile, Site, User
|
||||
|
||||
|
||||
class SiteAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'icon', 'url')
|
||||
|
||||
|
||||
class KeyInline(admin.TabularInline):
|
||||
model = Key
|
||||
extra = 1
|
||||
|
@ -23,5 +27,5 @@ class UserAdmin(BaseUserAdmin):
|
|||
)
|
||||
|
||||
|
||||
admin.site.register(Site)
|
||||
admin.site.register(Site, SiteAdmin)
|
||||
admin.site.register(User, UserAdmin)
|
||||
|
|
|
@ -73,7 +73,7 @@ class Profile(models.Model):
|
|||
display_name = models.CharField(max_length=100, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return '{name}@{site}'.format(name=self.username, site=self.site)
|
||||
return self.url
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
Loading…
Reference in a new issue