project/scipycon/registration/admin.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Fri, 10 Dec 2010 14:11:23 +0530
changeset 356 6a9bd80f5e6e
parent 310 3541adaa5cd3
child 357 bbfee5259b95
permissions -rw-r--r--
Add phone number field to Registration Admin page.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
from __future__ import absolute_import
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
#django.contrib
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
from django.contrib import admin
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
96
178b89a3ca4f Removed unwanted files and made more changes to make SciPyCon a clean app.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     7
#scipycon
310
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
     8
from .models import Accommodation
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
     9
from .models import Payment
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
from .models import Registration
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
from .models import Wifi
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
class RegistrationAdmin(admin.ModelAdmin):
356
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    14
    list_display = ('registrant', 'full_name', 'phone_num', 
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    15
                    'laptop', 'slug', 'email', 'city',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    16
                    'organisation', 'occupation', 'postcode',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    17
                    'tshirt', 'conference', 'tutorial',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    18
                    'sprint', 'allow_contact')
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
    fieldsets = (
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
        ('Details', {
356
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    21
            'fields': ('full_name', 'phone_num', 'slug',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    22
                       'laptop', 'slug', 'email', 'city',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    23
                       'organisation', 'occupation', 'postcode',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    24
                       'tshirt', 'conference', 'tutorial',
6a9bd80f5e6e Add phone number field to Registration Admin page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 310
diff changeset
    25
                       'sprint', 'allow_contact')
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    26
        }),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
        ('Information', {
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
            'fields': ('allow_contact',),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    29
        }),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    30
    )
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    32
    search_fields = ['registrant__username', 'registrant__email']
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    34
    def email(self, obj):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
        return obj.registrant.email
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
    def full_name(self, obj):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
        return obj.registrant.get_full_name()
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
    def laptop(self, obj):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
        return obj.registrant.wifi_set.values()[0]['wifi']
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
admin.site.register(Registration, RegistrationAdmin)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    44
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
class WifiAdmin(admin.ModelAdmin):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
    list_display = ('user', 'wifi',)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    47
    list_filter = ('wifi',)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    48
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    49
admin.site.register(Wifi, WifiAdmin)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    50
310
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    51
class AccommodationAdmin(admin.ModelAdmin):
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    52
    list_display = ('user', 'sex', 'accommodation_required',
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    53
                    'accommodation_days')
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    54
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    55
admin.site.register(Accommodation, AccommodationAdmin)
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    56
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    57
class PaymentAdmin(admin.ModelAdmin):
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    58
    list_display = ('user', 'confirmed', 'acco_confirmed')
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    59
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    60
admin.site.register(Payment, PaymentAdmin)
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    61
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    62