bessst
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

admin.py
text/x-python

Download raw (1.2 KB)

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import Individual, Organization, People, Friend
from wymeditor.admin import RichTextAdmin

class IndividualAdmin(RichTextAdmin):
    prepopulated_fields = {'slug': ('firstname', 'prefix', 'name')}
    fieldsets = (
        (_('General'), {
            'fields': (('name', 'prefix', 'firstname'), 'slug')
        }),
        (_('Coordinates'), {
            'fields': (('address', 'city'), 'phone', 'email', 'link')
        }),
        (_('Biography'), {
            'fields': ('biography', 'biography_en', 'biography_fr')
        })
    )

class OrganizationAdmin(RichTextAdmin):
    prepopulated_fields = {'slug': ('prefix', 'name')}
    filter_horizontal = ('individuals',)
    fieldsets = (
        (_('General'), {
            'fields': (('name', 'prefix'), 'slug')
        }),
        (_('Coordinates'), {
            'fields': ('contact_person', 'individuals', ('address', 'city'), 'phone', 'email', 'link')
        }),
        (_('Biography'), {
            'fields': ('biography', 'biography_en', 'biography_fr')
        })
    )

admin.site.register(Individual, IndividualAdmin)
admin.site.register(Organization, OrganizationAdmin)
admin.site.register(Friend)