-
Notifications
You must be signed in to change notification settings - Fork 19
/
admin.py
54 lines (45 loc) · 1.63 KB
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from mapstory.models import *
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.admin import UserAdmin
class ResourceForm(forms.ModelForm):
text = forms.CharField(widget=forms.Textarea)
class Meta:
model = Resource
class ResourceAdmin(admin.ModelAdmin):
list_display = 'id','name','order'
list_display_links = 'id',
list_editable = 'name','order'
form = ResourceForm
ordering = ['order',]
class SectionForm(forms.ModelForm):
text = forms.CharField(widget=forms.Textarea)
class Meta:
model = Section
class SectionAdmin(admin.ModelAdmin):
list_display = 'id','name','order'
list_display_links = 'id',
list_editable = 'name','order'
form = SectionForm
ordering = ['order',]
class VideoLinkForm(forms.ModelForm):
text = forms.CharField(widget=forms.Textarea)
class Meta:
model = VideoLink
class VideoLinkAdmin(admin.ModelAdmin):
list_display = 'id','name','title','href','publish','location'
list_display_links = 'id',
list_editable = 'name','title','publish','href','location'
form = VideoLinkForm
class ContactDetailAdmin(admin.ModelAdmin):
pass
#@hack the UserAdmin to enable sorting by date_joined
UserAdmin.list_display += ('date_joined',)
admin.site.register(VideoLink, VideoLinkAdmin)
admin.site.register(Section, SectionAdmin)
admin.site.register(ContactDetail, ContactDetailAdmin)
admin.site.register(Resource, ResourceAdmin)
admin.site.register(Topic)