Browse Source

Make some little quality-of-life improvements to the Django admin for my models

pull/1/head
Danielle McLean 5 years ago
parent
commit
75ed4503c8
Signed by: 00dani
GPG Key ID: 5A5D2D1AFF12EEC5
  1. 3
      entries/admin.py
  2. 6
      users/admin.py
  3. 2
      users/models.py

3
entries/admin.py

@ -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,
)

6
users/admin.py

@ -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)

2
users/models.py

@ -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…
Cancel
Save