Source

Lightning Talks / lightning / common / forms.py

Diff from to

lightning/common/forms.py

 
 from django.contrib.auth.models import User
 
-from uni_form.helpers import FormHelper, Submit, Reset
+from uni_form.helpers import FormHelper, Submit
+
+from common.models import Talk
 
 class ProfileForm(forms.ModelForm):
     class Meta:
         helper.form_action = ''
         helper.form_method = 'POST'
         return helper
+
+class TalkForm(forms.ModelForm):
+    class Meta:
+        model = Talk
+        exclude = ('user',)
+
+    def __init__(self, *args, **kwargs):
+        super(TalkForm, self).__init__(*args, **kwargs)
+        self.fields['url'].label = 'URL'
+
+    @property
+    def helper(self):
+        helper = FormHelper()
+        submit = Submit('save', 'Save', **{'css_class': 'primary'})
+        helper.add_input(submit)
+        helper.form_action = ''
+        helper.form_method = 'POST'
+        return helper