Permalink
Browse files

Added support for events in admin (fix#4005)

  • Loading branch information...
ricardinho committed Mar 11, 2013
1 parent e2a92fd commit 41c0660e9aa91b0d2e7a13b9f941ff55e7101c05
Showing with 27 additions and 14 deletions.
  1. +18 −14 committees/admin.py
  2. +9 −0 events/admin.py
View
@@ -4,44 +4,48 @@
from video.models import Video
from models import *
+
class CommitteeRelatedVideosInline(generic.GenericTabularInline):
model = Video
ct_fk_field = 'object_pk'
can_delete = False
- fields = ['title','description','embed_link','group','hide']
- ordering = ['group','-published']
- readonly_fields = ['title','description','embed_link','group']
+ fields = ['title', 'description', 'embed_link', 'group', 'hide']
+ ordering = ['group', '-published']
+ readonly_fields = ['title', 'description', 'embed_link', 'group']
extra = 0
+
def queryset(self, request):
qs = super(CommitteeRelatedVideosInline, self).queryset(request)
qs = qs.filter(Q(hide=False) | Q(hide=None))
return qs
-class EventsTable(GenericTabularInline):
- model = Event
- ct_field='which_type'
- ct_fk_field='which_pk'
class CommitteeAdmin(admin.ModelAdmin):
- ordering = ('name',)
- inlines = (CommitteeRelatedVideosInline, EventsTable)
+ ordering = ('name', )
+ inlines = (CommitteeRelatedVideosInline, )
+
+
admin.site.register(Committee, CommitteeAdmin)
+
class CommitteeMeetingAdmin(admin.ModelAdmin):
- ordering = ('-date',)
+ ordering = ('-date', )
+
+
admin.site.register(CommitteeMeeting, CommitteeMeetingAdmin)
+
class LinksTable(GenericTabularInline):
model = Link
- ct_field='content_type'
- ct_fk_field='object_pk'
+ ct_field = 'content_type'
+ ct_fk_field = 'object_pk'
class TopicAdmin(admin.ModelAdmin):
- ordering = ('-created',)
+ ordering = ('-created', )
inlines = [
LinksTable,
- EventsTable,
]
+
admin.site.register(Topic, TopicAdmin)
View
@@ -0,0 +1,9 @@
+from django.contrib import admin
+from events.models import Event
+
+
+class EventAdmin(admin.ModelAdmin):
+ pass
+
+
+admin.site.register(Event, EventAdmin)

0 comments on commit 41c0660

Please sign in to comment.