-class ThemaAdmin(admin.ModelAdmin):
- list_display = ['code', 'name', 'usable', 'hidden']
- list_filter = ['usable', 'hidden']
- search_fields = ['code', 'name', 'description']
+class ThemaAdmin(VersionAdmin):
+ list_display = ['code', 'name', 'usable', 'hidden', 'woblink_category']
+ list_filter = ['usable', 'usable_as_main', 'hidden']
+ search_fields = ['code', 'name', 'description', 'public_description']
+ prepopulated_fields = {"slug": ["name"]}
+
+
+
+class WoblinkSeriesWidget(WoblinkCatalogueWidget):
+ category = 'series'
+
+class AudienceForm(forms.ModelForm):
+ class Meta:
+ model = models.Audience
+ fields = '__all__'
+ widgets = {
+ 'woblink': WoblinkSeriesWidget,
+ }
+
+@admin.register(models.Audience)
+class AudienceAdmin(VersionAdmin):
+ form = AudienceForm
+ list_display = ['code', 'name', 'thema', 'woblink']
+ search_fields = ['code', 'name', 'description', 'thema', 'woblink']
+ prepopulated_fields = {"slug": ["name"]}
+ fields = ['code', 'name', 'slug', 'description', 'thema', ('woblink', 'woblink_id')]
+ readonly_fields = ['woblink_id']
+
+ def woblink_id(self, obj):
+ return obj.woblink or ''