summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-20 12:25:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-20 12:25:14 (GMT)
commit8b02218b9c1f524d37e2a20a613a7301a7aa7689 (patch)
tree117a06507f26b038bdaa704109c6226a04c3d508 /program
parent4313274eeb823448a156cf7891d6eb64efe67c13 (diff)
parentcb7893dd84f84549eadea316c7cd3faf68e5488b (diff)
Merge branch 'master' into stable
Diffstat (limited to 'program')
-rw-r--r--program/admin.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/program/admin.py b/program/admin.py
index 665ece2..d871e16 100644
--- a/program/admin.py
+++ b/program/admin.py
@@ -107,6 +107,17 @@ class ShowAdmin(admin.ModelAdmin):
'musicfocus',
)
+ def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
+ try:
+ show_id = int(request.get_full_path().split('/')[-2])
+ except ValueError:
+ show_id = None
+
+ if db_field.name == 'predecessor' and show_id:
+ kwargs['queryset'] = Show.objects.exclude(pk=show_id)
+
+ return super(ShowAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
+
admin.site.register(BroadcastFormat, BroadcastFormatAdmin)
admin.site.register(MusicFocus, MusicFocusAdmin)
admin.site.register(ShowInformation, ShowInformationAdmin)