diff --git a/boards/forms.py b/boards/forms.py --- a/boards/forms.py +++ b/boards/forms.py @@ -95,6 +95,5 @@ class ThreadCaptchaForm(ThreadForm): captcha = CaptchaField() - class SettingsForm(forms.Form): theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect) \ No newline at end of file diff --git a/boards/urls.py b/boards/urls.py --- a/boards/urls.py +++ b/boards/urls.py @@ -22,9 +22,5 @@ urlpatterns = patterns('', # /boards/theme/theme_name/ url(r'^settings$', views.settings, name='settings'), url(r'^tags$', views.all_tags, name='tags'), -) - -#enable captcha support -urlpatterns += patterns('', url(r'^captcha/', include('captcha.urls')), -) +) \ No newline at end of file diff --git a/boards/utils.py b/boards/utils.py --- a/boards/utils.py +++ b/boards/utils.py @@ -1,6 +1,7 @@ """ This module contains helper functions and helper classes. """ +from neboard import settings def check_if_human(request): @@ -10,4 +11,4 @@ def check_if_human(request): """ # FIXME: need to insert checking logic - return True + return not settings.ENABLE_CAPTCHA diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -22,7 +22,7 @@ def index(request, page=0): if request.method == 'POST': form = threadFormClass(request.POST, request.FILES, - error_class=PlainErrorList) + error_class=PlainErrorList) if form.is_valid(): return _new_post(request, form) @@ -119,13 +119,12 @@ def tag(request, tag_name, page=0): def thread(request, post_id): """Get all thread posts""" - postFormClass = (PostForm - if utils.check_if_human(request) - else PostCaptchaForm) + postFormClass = (PostForm if utils.check_if_human(request) else + PostCaptchaForm) if request.method == 'POST': form = postFormClass(request.POST, request.FILES, - error_class=PlainErrorList) + error_class=PlainErrorList) if form.is_valid(): return _new_post(request, form, post_id) else: diff --git a/neboard/settings.py b/neboard/settings.py --- a/neboard/settings.py +++ b/neboard/settings.py @@ -190,4 +190,6 @@ THEMES = [ DEFAULT_THEME = 'md' POPULAR_TAGS = 10 -LAST_REPLIES_COUNT = 3 \ No newline at end of file +LAST_REPLIES_COUNT = 3 + +ENABLE_CAPTCHA = True \ No newline at end of file diff --git a/templates/posting_general.html b/templates/posting_general.html --- a/templates/posting_general.html +++ b/templates/posting_general.html @@ -106,32 +106,31 @@