project/scipycon/registration/admin.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Fri, 10 Dec 2010 14:20:18 +0530
changeset 357 bbfee5259b95
parent 356 6a9bd80f5e6e
permissions -rw-r--r--
Removed non-form fields from detailed fields display.
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', {
357
bbfee5259b95 Removed non-form fields from detailed fields display.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 356
diff changeset
    21
            'fields': ('slug', 'registrant', 'organisation', 'occupation',
bbfee5259b95 Removed non-form fields from detailed fields display.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 356
diff changeset
    22
                'city', 'tshirt')
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
        }),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
        ('Information', {
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    25
            '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
    26
        }),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
    )
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    29
    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
    30
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
    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
    32
        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
    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 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
    35
        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
    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 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
    38
        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
    39
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
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
    41
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
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
    43
    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
    44
    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
    45
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
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
    47
310
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    48
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
    49
    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
    50
                    'accommodation_days')
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    51
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    52
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
    53
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    54
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
    55
    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
    56
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    57
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
    58
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    59