add Topik object, wrapper around Page
[django-panik-combo.git] / panikombo / forms.py
index ed3991a..d7a20a6 100644 (file)
@@ -1,9 +1,11 @@
 from django import forms
 from django_select2.widgets import HeavySelect2Widget, convert_to_js_string_arr
+from taggit.forms import TagWidget
 
 from emissions.models import SoundFile, Episode
 
-from .models import SoundCell, EpisodeCell
+from .models import (SoundCell, EpisodeCell, EpisodeAutoSelectionCell,
+        NewsItemAutoSelectionCell, Topik)
 from .views import soundfiles, episodes
 
 class SoundFileWidget(HeavySelect2Widget):
@@ -44,3 +46,23 @@ class EpisodeCellForm(forms.ModelForm):
     def __init__(self, *args, **kwargs):
         super(EpisodeCellForm, self).__init__(*args, **kwargs)
         self.fields['episode'].widget = EpisodeWidget(data_view=episodes)
+
+
+class EpisodeAutoSelectionCellForm(forms.ModelForm):
+    class Meta:
+        model = EpisodeAutoSelectionCell
+        fields = ('title', 'tags', 'category')
+        widgets = {'tags': TagWidget()}
+
+
+class NewsItemAutoSelectionCellForm(forms.ModelForm):
+    class Meta:
+        model = NewsItemAutoSelectionCell
+        fields = ('title', 'tags', 'future')
+        widgets = {'tags': TagWidget()}
+
+
+class TopikEditForm(forms.ModelForm):
+    class Meta:
+        model = Topik
+        fields = ('image',)