tildetown-admin/ttadmin/users/admin.py

26 lines
658 B
Python
Raw Normal View History

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
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-14 22:25:50 +00:00
list_display = ('reviewed', 'username', 'email')
ordering = ('reviewed',)
actions = (bulk_review,)