2016-11-20 05:34:38 +00:00
|
|
|
from django.contrib import admin
|
2017-01-14 06:22:28 +00:00
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from django.contrib.auth.models import Group
|
|
|
|
|
2017-01-14 06:34:08 +00:00
|
|
|
from .models import Townie, Pubkey
|
2016-11-20 05:34:38 +00:00
|
|
|
|
2017-01-14 06:22:28 +00:00
|
|
|
admin.site.unregister(User)
|
|
|
|
admin.site.unregister(Group)
|
|
|
|
|
2017-01-14 06:34:08 +00:00
|
|
|
class PubkeyInline(admin.TabularInline):
|
|
|
|
model = Pubkey
|
2017-01-21 09:06:35 +00:00
|
|
|
extra = 1
|
2017-01-14 06:34:08 +00:00
|
|
|
|
2017-01-21 08:35:00 +00:00
|
|
|
def bulk_review(madmin, req, qs):
|
|
|
|
for townie in qs:
|
|
|
|
townie.reviewed = True
|
|
|
|
townie.save()
|
|
|
|
|
|
|
|
bulk_review.short_description = 'mark selected townies as reviewed'
|
|
|
|
|
2016-11-20 05:34:38 +00:00
|
|
|
@admin.register(Townie)
|
|
|
|
class TownieAdmin(admin.ModelAdmin):
|
2017-01-14 06:34:08 +00:00
|
|
|
inlines = [PubkeyInline]
|
2017-01-21 09:06:35 +00:00
|
|
|
list_display = ('username', 'reviewed', 'email')
|
2017-01-14 22:25:50 +00:00
|
|
|
ordering = ('reviewed',)
|
2017-01-21 09:06:35 +00:00
|
|
|
exclude = ('first_name', 'last_name', 'password', 'groups', 'user_permissions', 'last_login')
|
2017-01-21 08:35:00 +00:00
|
|
|
actions = (bulk_review,)
|