Browse Source

Fixed regression on prefix field.

Rafał Pitoń 11 years ago
parent
commit
355997ef5d
2 changed files with 4 additions and 3 deletions
  1. 1 1
      misago/apps/threads/forms.py
  2. 3 2
      misago/apps/threadtype/posting/forms.py

+ 1 - 1
misago/apps/threads/forms.py

@@ -148,7 +148,7 @@ class ThreadPrefixMixin(object):
             self.add_field('thread_prefix',
                            forms.TypedChoiceField(label=_("Thread Prefix"),
                                                   choices=[(0, _("No prefix"))] + [(p.pk, _(p.name)) for p in self.prefixes.values()],
-                                                  coerce=int, required=False, empty_value=0, initial=self.thread.prefix_id))
+                                                  coerce=int, required=False, empty_value=0, initial=self.thread.prefix_id if self.thread else None))
 
 
 class NewThreadForm(NewThreadFormBase, PollFormMixin, ThreadPrefixMixin):

+ 3 - 2
misago/apps/threadtype/posting/forms.py

@@ -51,9 +51,10 @@ class PostingForm(FloodProtectionMixin, Form, ValidatePostLengthMixin):
 
         # Give inheritor chance to set custom fields
         try:
-            self.type_fields()
+            type_fields_call = self.type_fields
         except AttributeError:
-            pass
+            type_fields_call = None
+        type_fields_call()
 
     def clean_thread_weight(self):
         data = self.cleaned_data['thread_weight']