diff forums/forms.py @ 722:71d17d267e27

Added an ajax form to upload photos & update post box w/image code.
author Brian Neal <bgneal@gmail.com>
date Sat, 21 Sep 2013 17:00:49 -0500
parents 92101013d5ac
children 5366c29d6dce
line wrap: on
line diff
--- a/forums/forms.py	Thu Sep 19 20:00:10 2013 -0500
+++ b/forums/forms.py	Sat Sep 21 17:00:49 2013 -0500
@@ -13,6 +13,17 @@
 from forums.signals import notify_new_topic, notify_new_post
 
 
+FORUMS_FORM_CSS = {
+    'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
+            settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
+}
+FORUMS_FORM_JS = (
+    settings.GPP_THIRD_PARTY_JS['markitup'] +
+    settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
+    ['js/jquery.form.min.js', 'js/forums.js']
+)
+
+
 class NewPostForm(forms.Form):
     """Form for creating a new post."""
     body = forms.CharField(label='',
@@ -22,13 +33,8 @@
     topic = None
 
     class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                settings.GPP_THIRD_PARTY_CSS['jquery-ui']),
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-                settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-                ['js/forums.js'])
+        css = FORUMS_FORM_CSS
+        js = FORUMS_FORM_JS
 
     def __init__(self, *args, **kwargs):
         super(NewPostForm, self).__init__(*args, **kwargs)
@@ -76,13 +82,8 @@
     has_mod_fields = False
 
     class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                settings.GPP_THIRD_PARTY_CSS['jquery-ui']),
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-                settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-                ['js/forums.js'])
+        css = FORUMS_FORM_CSS
+        js = FORUMS_FORM_JS
 
     def __init__(self, user, forum, *args, **kwargs):
         super(NewTopicForm, self).__init__(*args, **kwargs)
@@ -153,13 +154,8 @@
         fields = ('body', )
 
     class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                settings.GPP_THIRD_PARTY_CSS['jquery-ui']),
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-                settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-                ['js/forums.js'])
+        css = FORUMS_FORM_CSS
+        js = FORUMS_FORM_JS
 
     def __init__(self, *args, **kwargs):
         topic_name = kwargs.pop('topic_name', None)