project/kiwipycon/registration/admin.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Sat, 12 Dec 2009 03:18:18 +0530
changeset 65 282cd6aa9fd8
parent 1 fda1c66b25f9
child 66 fdcf8ee37f4e
permissions -rw-r--r--
Admin page changes to get the name and search fields.

# -*- coding: utf-8 -*-
from __future__ import absolute_import

#django.contrib
from django.contrib import admin

#kiwipycon
from .models import Registration
from .models import Wifi

class RegistrationAdmin(admin.ModelAdmin):
    list_display = ('registrant', 'full_name', 'slug', 'email', 'city', 
            'organisation', 'occupation', 'postcode',
            'tshirt', 'conference', 'tutorial', 'sprint',
            'allow_contact')
    fieldsets = (
        ('Details', {
            'fields': ('slug', 'registrant', 'organisation', 'occupation',
                'city', 'tshirt')
        }),
        ('Information', {
            'fields': ('allow_contact',),
        }),
    )

    search_fields = ['registrant__username', 'registrant__email']

    def email(self, obj):
        return obj.registrant.email

    def full_name(self, obj):
        return obj.registrant.get_full_name()

admin.site.register(Registration, RegistrationAdmin)

class WifiAdmin(admin.ModelAdmin):
    list_display = ('user', 'wifi',)
    list_filter = ('wifi',)

admin.site.register(Wifi, WifiAdmin)