admin.py 1.92 KB
Newer Older
1 2 3 4
# -*- coding: utf-8 -*-.
from django.contrib import admin
from eduroam.edumanage.models import *

5 6 7 8 9
from django.contrib.contenttypes import generic


class NameInline(generic.GenericTabularInline):
    model = Name_i18n
10 11 12 13
    
class UrlInline(generic.GenericTabularInline):
    model = URL_i18n

14 15 16

class InstitutionAdmin(admin.ModelAdmin):
    inlines = [
17 18 19 20 21 22
        NameInline, 
    ]

class InstitutionDetailsAdmin(admin.ModelAdmin):
    inlines = [
        UrlInline, 
23 24 25 26 27 28 29
    ]

class ServiceLocAdmin(admin.ModelAdmin):
    inlines = [
        NameInline,
    ]

30 31 32 33
class RealmInLine(admin.ModelAdmin):
    inlines = [
        UrlInline,
    ]
34

35 36 37
   
admin.site.register(Name_i18n)
admin.site.register(Contact)
38
admin.site.register(InstitutionContactPool)
39 40 41 42 43 44
admin.site.register(URL_i18n)
admin.site.register(InstRealm)
admin.site.register(InstServer)
admin.site.register(InstRealmMon)
admin.site.register(MonProxybackClient)
admin.site.register(MonLocalEAPOLData)
45 46
admin.site.register(ServiceLoc, ServiceLocAdmin)
admin.site.register(Institution, InstitutionAdmin)
47
admin.site.register(InstitutionDetails, InstitutionDetailsAdmin)
48
admin.site.register(Realm, RealmInLine)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
admin.site.register(RealmData)

from django import forms
from django.core.urlresolvers import reverse
from django.contrib.flatpages.admin import FlatPageAdmin
from django.contrib.flatpages.models import FlatPage
from tinymce.widgets import TinyMCE

class TinyMCEFlatPageAdmin(FlatPageAdmin):
    def formfield_for_dbfield(self, db_field, **kwargs):
        if db_field.name == 'content':
            return forms.CharField(widget=TinyMCE(
                attrs={'cols': 80, 'rows': 30},
                mce_attrs={'external_link_list_url': reverse('tinymce.views.flatpages_link_list')},
            ))
        return super(TinyMCEFlatPageAdmin, self).formfield_for_dbfield(db_field, **kwargs)

from django.contrib import admin

admin.site.unregister(FlatPage)
admin.site.register(FlatPage, TinyMCEFlatPageAdmin)