]> git.openstreetmap.org Git - osqa.git/commitdiff
Previous feature addition commit introduced errors; rolling back to previous revision...
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 7 Jan 2011 16:25:01 +0000 (16:25 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 7 Jan 2011 16:25:01 +0000 (16:25 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@674 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/forms/qanda.py
forum/settings/minrep.py
forum/skins/default/templates/answer_edit.html
forum/skins/default/templates/ask.html
forum/skins/default/templates/question.html
forum/skins/default/templates/question_edit.html
forum/views/readers.py
forum/views/writers.py
urls.py

index 9c33403c5230857dc4b0a01f4f3bc5f138f1cd47..b499cbdebdd8e4f1f80c0722134838870efa740f 100644 (file)
@@ -8,9 +8,6 @@ from django.contrib.humanize.templatetags.humanize import apnumber
 from django.utils.safestring import mark_safe
 from general import NextUrlField, UserNameField, SetPasswordForm
 from forum import settings
-
-#from forum_modules.recaptcha.formfield import ReCaptchaField
-
 import logging
 
 class TitleField(forms.CharField):
@@ -157,9 +154,6 @@ class AskForm(forms.Form):
         super(AskForm, self).__init__(data, *args, **kwargs)
 
         self.fields['tags']   = TagNamesField(user)
-        
-        #if int(user.reputation) < settings.CAPTCHA_IF_REP_LESS_THAN and not (user.is_superuser or user.is_staff):
-        #    self.fields['captcha'] = ReCaptchaField()
 
         if settings.WIKI_ON:
             self.fields['wiki'] = WikiField()
@@ -168,15 +162,16 @@ class AnswerForm(forms.Form):
     text   = AnswerEditorField()
     wiki   = WikiField()
 
-    def __init__(self, data=None, user=None, *args, **kwargs):
-        super(AnswerForm, self).__init__(data, *args, **kwargs)
-        
-        #if int(user.reputation) < settings.CAPTCHA_IF_REP_LESS_THAN and not (user.is_superuser or user.is_staff):
-        #    self.fields['captcha'] = ReCaptchaField()
+    def __init__(self, question, *args, **kwargs):
+        super(AnswerForm, self).__init__(*args, **kwargs)
 
         if settings.WIKI_ON:
             self.fields['wiki'] = WikiField()
 
+            #if question.nis.wiki:
+            #    self.fields['wiki'].initial = True
+
+
 class RetagQuestionForm(forms.Form):
     tags   = TagNamesField()
     # initialize the default values
@@ -219,9 +214,6 @@ class EditQuestionForm(forms.Form):
         self.fields['tags'] = TagNamesField(user)
         self.fields['tags'].initial = revision.tagnames
 
-        #if int(user.reputation) < settings.CAPTCHA_IF_REP_LESS_THAN and not (user.is_superuser or user.is_staff):
-        #    self.fields['captcha'] = ReCaptchaField()
-
         if settings.WIKI_ON:
             self.fields['wiki'] = WikiField(disabled=(question.nis.wiki and not user.can_cancel_wiki(question)), initial=question.nis.wiki)
 
@@ -237,9 +229,6 @@ class EditAnswerForm(forms.Form):
 
         self.fields['text'].initial = revision.body
 
-        #if int(user.reputation) < settings.CAPTCHA_IF_REP_LESS_THAN and not (user.is_superuser or user.is_staff):
-        #    self.fields['captcha'] = ReCaptchaField()
-        
         if settings.WIKI_ON:
             self.fields['wiki'] = WikiField(disabled=(answer.nis.wiki and not user.can_cancel_wiki(answer)), initial=answer.nis.wiki)
 
index f00053e7f2451e18327ce91f737f021ac991f923..b2ff60d172df6a9416979de875f15611d4062239 100644 (file)
@@ -3,10 +3,6 @@ from django.utils.translation import ugettext_lazy as _
 \r
 MIN_REP_SET = SettingSet('minrep', _('Minimum reputation config'), _("Configure the minimum reputation required to perform certain actions on your site."), 300)\r
 \r
-#CAPTCHA_IF_REP_LESS_THAN = Setting('CAPTCHA_IF_REP_LESS_THAN', 0, MIN_REP_SET, dict(\r
-#label = _("Show captcha if user with less reputation than"),\r
-#help_text = _("If the user has less reputation, captcha is used to when adding new content.")))\r
-\r
 REP_TO_VOTE_UP = Setting('REP_TO_VOTE_UP', 15, MIN_REP_SET, dict(\r
 label = _("Minimum reputation to vote up"),\r
 help_text = _("The minimum reputation an user must have to be allowed to vote up.")))\r
index c0315e6df03b9332c2ccd4b814009d1fbdd9a7b4..c9d846626eb4a94bdfc2e044bd34b0e41a350faf 100644 (file)
             <div class="title-desc">
                 {{ form.summary.help_text }}
             </div>
-            
-            {% if form.captcha %}
-            <div class="question-captcha">
-               {{ form.captcha.errors }}
-               {{ form.captcha }}
-            </div>
-            {% endif %}
-            
             <input type="button" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event, this.form)" />
             <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="submitClicked(event, this.form);history.back(-1);" />
         </form>
index 04e959eabd74bf8c0b7b3da84de7dae16d4c1215..bb4ad67357cd8e3154ff1669f27737aaa97a0428 100644 (file)
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
-                       
-            {% if form.captcha %}
-            <div class="question-captcha" style="float: left">
-               {{ form.captcha.errors }}
-               {{ form.captcha }}
-            </div>
-            <div class="clear"></div>
-            {% endif %}
-                       
             {% if not request.user.is_authenticated %}                                                                        
             <input name="ask" type="button" value="{% trans "Login/signup to post your question" %}" class="submit" onclick="submitClicked(event, this.form)"/>
                        {% else %}
index 4873d145f87d66083b2b0c597f2da866f3f29546..efb797b243b37fe22166ddf87ca6b4985355f5c5 100644 (file)
                     {{ answer.text.errors }}\r
                     <div id="previewer" class="wmd-preview"></div>                    \r
                 </div>\r
-                \r
-                   {% if answer.captcha %}\r
-                   <div class="question-captcha" style="float: left;">\r
-                       {{ answer.captcha.errors }}\r
-                       {{ answer.captcha }}\r
-                   </div>\r
-                   <div class="clear"></div>\r
-                   {% endif %}\r
-                \r
                 <p><span class="form-error"></span></p>\r
                 <input type="button"\r
                     {% if user.is_anonymous %}\r
index f30ee9693cd7726ca874ed7fc3156abb3c95df3d..f0c9e4dd00f808ea93cb2bdfd318bbfc19edf22d 100644 (file)
             <div class="title-desc">
                 {{ form.summary.help_text }}
             </div>
-            
-            {% if form.captcha %}
-            <div class="question-captcha" style="float: left">
-               {{ form.captcha.errors }}
-               {{ form.captcha }}
-            </div>
-            <div class="clear"></div>
-            {% endif %}
-            
             <div class="error" ></div>
             <input type="button" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event, this.form)" />
             <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="submitClicked(event, null); history.back(-1);" />
index f8113be2f6da4e091d9fc8ad39830794bfbafa4e..e0929220b6b0dfa5d9f3a1967d71b0b18ba42b45 100644 (file)
@@ -314,9 +314,9 @@ def question(request, id, slug='', answer=None):
         return HttpResponsePermanentRedirect(question.get_absolute_url())
 
     if request.POST:
-        answer_form = AnswerForm(request.POST, user=request.user)
+        answer_form = AnswerForm(question, request.POST)
     else:
-        answer_form = AnswerForm(user=request.user)
+        answer_form = AnswerForm(question)
 
     answers = request.user.get_visible_answers(question)
 
index dbc68c017c4c583160e453031e2400fef4b013d6..125318b765edee0a8c65bdbb57bb5bcc1f629dd7 100644 (file)
@@ -218,7 +218,7 @@ def answer(request, id):
     question = get_object_or_404(Question, id=id)
 
     if request.POST:
-        form = AnswerForm(request.POST, request.user)
+        form = AnswerForm(question, request.POST)
 
         if request.session.pop('reviewing_pending_data', False) or not form.is_valid():
             request.session['redirect_POST_data'] = request.POST
diff --git a/urls.py b/urls.py
index 09326099515306a3c765e30346c104e5dfff6438..51fa72080700056993c6f007270e51a7de9fe903 100644 (file)
--- a/urls.py
+++ b/urls.py
@@ -7,7 +7,7 @@ urlpatterns = patterns('',
 )
 
 if 'rosetta' in settings.INSTALLED_APPS:
-    urlpatterns = patterns('',
+    urlpatterns += patterns('',
         url(r'^rosetta/', include('rosetta.urls')),
-    ) + urlpatterns
+    )