project/kiwipycon/registration/admin.py
changeset 66 fdcf8ee37f4e
parent 65 282cd6aa9fd8
equal deleted inserted replaced
65:282cd6aa9fd8 66:fdcf8ee37f4e
     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', 'full_name', 'slug', 'email', 'city', 
    12     list_display = ('registrant', 'full_name', 'laptop', 'slug',
    13             'organisation', 'occupation', 'postcode',
    13             'email', 'city', 'organisation', 'occupation',
    14             'tshirt', 'conference', 'tutorial', 'sprint',
    14             'postcode', 'tshirt', 'conference', 'tutorial',
    15             'allow_contact')
    15             'sprint', 'allow_contact')
    16     fieldsets = (
    16     fieldsets = (
    17         ('Details', {
    17         ('Details', {
    18             'fields': ('slug', 'registrant', 'organisation', 'occupation',
    18             'fields': ('slug', 'registrant', 'organisation', 'occupation',
    19                 'city', 'tshirt')
    19                 'city', 'tshirt')
    20         }),
    20         }),
    29         return obj.registrant.email
    29         return obj.registrant.email
    30 
    30 
    31     def full_name(self, obj):
    31     def full_name(self, obj):
    32         return obj.registrant.get_full_name()
    32         return obj.registrant.get_full_name()
    33 
    33 
       
    34     def laptop(self, obj):
       
    35         return obj.registrant.wifi_set.values()[0]['wifi']
       
    36 
    34 admin.site.register(Registration, RegistrationAdmin)
    37 admin.site.register(Registration, RegistrationAdmin)
    35 
    38 
    36 class WifiAdmin(admin.ModelAdmin):
    39 class WifiAdmin(admin.ModelAdmin):
    37     list_display = ('user', 'wifi',)
    40     list_display = ('user', 'wifi',)
    38     list_filter = ('wifi',)
    41     list_filter = ('wifi',)