project/kiwipycon/registration/admin.py
changeset 65 282cd6aa9fd8
parent 1 fda1c66b25f9
child 66 fdcf8ee37f4e
equal deleted inserted replaced
64:af5a8b6cbe4b 65:282cd6aa9fd8
     7 #kiwipycon
     7 #kiwipycon
     8 from .models import Registration
     8 from .models import Registration
     9 from .models import Wifi
     9 from .models import Wifi
    10 
    10 
    11 class RegistrationAdmin(admin.ModelAdmin):
    11 class RegistrationAdmin(admin.ModelAdmin):
    12     list_display = ('registrant', 'slug', 'email', 'city', 
    12     list_display = ('registrant', 'full_name', 'slug', 'email', 'city', 
    13             'organisation', 'occupation', 'postcode',
    13             'organisation', 'occupation', 'postcode',
    14             'tshirt', 'conference', 'tutorial', 'sprint',
    14             'tshirt', 'conference', 'tutorial', 'sprint',
    15             'allow_contact')
    15             'allow_contact')
    16     fieldsets = (
    16     fieldsets = (
    17         ('Details', {
    17         ('Details', {
    21         ('Information', {
    21         ('Information', {
    22             'fields': ('allow_contact',),
    22             'fields': ('allow_contact',),
    23         }),
    23         }),
    24     )
    24     )
    25 
    25 
       
    26     search_fields = ['registrant__username', 'registrant__email']
       
    27 
    26     def email(self, obj):
    28     def email(self, obj):
    27         return obj.registrant.email
    29         return obj.registrant.email
    28 
    30 
       
    31     def full_name(self, obj):
       
    32         return obj.registrant.get_full_name()
    29 
    33 
    30 admin.site.register(Registration, RegistrationAdmin)
    34 admin.site.register(Registration, RegistrationAdmin)
    31 
    35 
    32 class WifiAdmin(admin.ModelAdmin):
    36 class WifiAdmin(admin.ModelAdmin):
    33     list_display = ('user', 'wifi',)
    37     list_display = ('user', 'wifi',)