to the draft parser (incorporating patch from trunk), store the extracted country instead of trying to turn it into an ISO country code, add country and continent name models and add initial data for those, add helper function for cleaning the countries, add author country and continent charts, move the affiliation models to stats/models.py, fix a bunch of bugs. - Legacy-Id: 12846
35 lines
1 KiB
Python
35 lines
1 KiB
Python
from django.contrib import admin
|
|
|
|
|
|
from ietf.person.models import Email, Alias, Person
|
|
from ietf.person.name import name_parts
|
|
|
|
class EmailAdmin(admin.ModelAdmin):
|
|
list_display = ["address", "person", "time", "active", ]
|
|
raw_id_fields = ["person", ]
|
|
search_fields = ["address", "person__name", ]
|
|
admin.site.register(Email, EmailAdmin)
|
|
|
|
class EmailInline(admin.TabularInline):
|
|
model = Email
|
|
|
|
class AliasAdmin(admin.ModelAdmin):
|
|
list_display = ["name", "person", ]
|
|
search_fields = ["name",]
|
|
raw_id_fields = ["person"]
|
|
admin.site.register(Alias, AliasAdmin)
|
|
|
|
class AliasInline(admin.StackedInline):
|
|
model = Alias
|
|
|
|
class PersonAdmin(admin.ModelAdmin):
|
|
def plain_name(self, obj):
|
|
prefix, first, middle, last, suffix = name_parts(obj.name)
|
|
return "%s %s" % (first, last)
|
|
list_display = ["name", "short", "plain_name", "time", "user", ]
|
|
search_fields = ["name", "ascii"]
|
|
raw_id_fields = ["user"]
|
|
inlines = [ EmailInline, AliasInline, ]
|
|
# actions = None
|
|
admin.site.register(Person, PersonAdmin)
|