From 8c29337f201187a1d8aa0110c9faf36b5d4f9219 Mon Sep 17 00:00:00 2001 From: hernani Date: Fri, 7 Jan 2011 16:25:01 +0000 Subject: [PATCH] Previous feature addition commit introduced errors; rolling back to previous revision while the feature code is reviewed. -CAC git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@674 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/forms/qanda.py | 23 +++++-------------- forum/settings/minrep.py | 4 ---- .../skins/default/templates/answer_edit.html | 8 ------- forum/skins/default/templates/ask.html | 9 -------- forum/skins/default/templates/question.html | 9 -------- .../default/templates/question_edit.html | 9 -------- forum/views/readers.py | 4 ++-- forum/views/writers.py | 2 +- urls.py | 4 ++-- 9 files changed, 11 insertions(+), 61 deletions(-) diff --git a/forum/forms/qanda.py b/forum/forms/qanda.py index 9c33403..b499cbd 100644 --- a/forum/forms/qanda.py +++ b/forum/forms/qanda.py @@ -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) diff --git a/forum/settings/minrep.py b/forum/settings/minrep.py index f00053e..b2ff60d 100644 --- a/forum/settings/minrep.py +++ b/forum/settings/minrep.py @@ -3,10 +3,6 @@ from django.utils.translation import ugettext_lazy as _ MIN_REP_SET = SettingSet('minrep', _('Minimum reputation config'), _("Configure the minimum reputation required to perform certain actions on your site."), 300) -#CAPTCHA_IF_REP_LESS_THAN = Setting('CAPTCHA_IF_REP_LESS_THAN', 0, MIN_REP_SET, dict( -#label = _("Show captcha if user with less reputation than"), -#help_text = _("If the user has less reputation, captcha is used to when adding new content."))) - REP_TO_VOTE_UP = Setting('REP_TO_VOTE_UP', 15, MIN_REP_SET, dict( label = _("Minimum reputation to vote up"), help_text = _("The minimum reputation an user must have to be allowed to vote up."))) diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index c0315e6..c9d8466 100644 --- a/forum/skins/default/templates/answer_edit.html +++ b/forum/skins/default/templates/answer_edit.html @@ -90,14 +90,6 @@
{{ form.summary.help_text }}
- - {% if form.captcha %} -
- {{ form.captcha.errors }} - {{ form.captcha }} -
- {% endif %} - diff --git a/forum/skins/default/templates/ask.html b/forum/skins/default/templates/ask.html index 04e959e..bb4ad67 100644 --- a/forum/skins/default/templates/ask.html +++ b/forum/skins/default/templates/ask.html @@ -148,15 +148,6 @@

{{ form.tags.help_text }}

- - {% if form.captcha %} -
- {{ form.captcha.errors }} - {{ form.captcha }} -
-
- {% endif %} - {% if not request.user.is_authenticated %} {% else %} diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 4873d14..efb797b 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -241,15 +241,6 @@ {{ answer.text.errors }}
- - {% if answer.captcha %} -
- {{ answer.captcha.errors }} - {{ answer.captcha }} -
-
- {% endif %} -

{{ form.summary.help_text }} - - {% if form.captcha %} -
- {{ form.captcha.errors }} - {{ form.captcha }} -
-
- {% endif %} -
diff --git a/forum/views/readers.py b/forum/views/readers.py index f8113be..e092922 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -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) diff --git a/forum/views/writers.py b/forum/views/writers.py index dbc68c0..125318b 100644 --- a/forum/views/writers.py +++ b/forum/views/writers.py @@ -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 0932609..51fa720 100644 --- 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 + ) -- 2.39.5