project/scipycon/registration/admin.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Mon, 29 Nov 2010 21:16:22 +0530
changeset 310 3541adaa5cd3
parent 96 178b89a3ca4f
child 356 6a9bd80f5e6e
permissions -rw-r--r--
Provide Javascript support and add all view related changes for form.
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):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
    list_display = ('registrant', 'full_name', 'laptop', 'slug',
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
            'email', 'city', 'organisation', 'occupation',
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
            'postcode', 'tshirt', 'conference', 'tutorial',
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
            'sprint', 'allow_contact')
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
    fieldsets = (
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
        ('Details', {
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
            'fields': ('slug', 'registrant', 'organisation', 'occupation',
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
                'city', 'tshirt')
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
        }),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
        ('Information', {
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
            '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
    25
        }),
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
    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
    29
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    30
    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
    31
        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
    32
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
    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
    34
        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
    35
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
    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
    37
        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
    38
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
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
    40
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
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
    42
    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
    43
    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
    44
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
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
    46
310
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    47
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
    48
    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
    49
                    'accommodation_days')
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    50
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    51
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
    52
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    53
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
    54
    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
    55
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    56
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
    57
3541adaa5cd3 Provide Javascript support and add all view related changes for form.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 96
diff changeset
    58