Show More
@@ -95,6 +95,5 b' class ThreadCaptchaForm(ThreadForm):' | |||||
95 | captcha = CaptchaField() |
|
95 | captcha = CaptchaField() | |
96 |
|
96 | |||
97 |
|
97 | |||
98 |
|
||||
99 | class SettingsForm(forms.Form): |
|
98 | class SettingsForm(forms.Form): | |
100 | theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect) No newline at end of file |
|
99 | theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect) |
@@ -22,9 +22,5 b" urlpatterns = patterns(''," | |||||
22 | # /boards/theme/theme_name/ |
|
22 | # /boards/theme/theme_name/ | |
23 | url(r'^settings$', views.settings, name='settings'), |
|
23 | url(r'^settings$', views.settings, name='settings'), | |
24 | url(r'^tags$', views.all_tags, name='tags'), |
|
24 | url(r'^tags$', views.all_tags, name='tags'), | |
25 | ) |
|
|||
26 |
|
||||
27 | #enable captcha support |
|
|||
28 | urlpatterns += patterns('', |
|
|||
29 | url(r'^captcha/', include('captcha.urls')), |
|
25 | url(r'^captcha/', include('captcha.urls')), | |
30 |
) |
|
26 | ) No newline at end of file |
@@ -1,6 +1,7 b'' | |||||
1 | """ |
|
1 | """ | |
2 | This module contains helper functions and helper classes. |
|
2 | This module contains helper functions and helper classes. | |
3 | """ |
|
3 | """ | |
|
4 | from neboard import settings | |||
4 |
|
5 | |||
5 |
|
6 | |||
6 | def check_if_human(request): |
|
7 | def check_if_human(request): | |
@@ -10,4 +11,4 b' def check_if_human(request):' | |||||
10 | """ |
|
11 | """ | |
11 |
|
12 | |||
12 | # FIXME: need to insert checking logic |
|
13 | # FIXME: need to insert checking logic | |
13 | return True |
|
14 | return not settings.ENABLE_CAPTCHA |
@@ -22,7 +22,7 b' def index(request, page=0):' | |||||
22 |
|
22 | |||
23 | if request.method == 'POST': |
|
23 | if request.method == 'POST': | |
24 | form = threadFormClass(request.POST, request.FILES, |
|
24 | form = threadFormClass(request.POST, request.FILES, | |
25 | error_class=PlainErrorList) |
|
25 | error_class=PlainErrorList) | |
26 |
|
26 | |||
27 | if form.is_valid(): |
|
27 | if form.is_valid(): | |
28 | return _new_post(request, form) |
|
28 | return _new_post(request, form) | |
@@ -119,13 +119,12 b' def tag(request, tag_name, page=0):' | |||||
119 | def thread(request, post_id): |
|
119 | def thread(request, post_id): | |
120 | """Get all thread posts""" |
|
120 | """Get all thread posts""" | |
121 |
|
121 | |||
122 | postFormClass = (PostForm |
|
122 | postFormClass = (PostForm if utils.check_if_human(request) else | |
123 | if utils.check_if_human(request) |
|
123 | PostCaptchaForm) | |
124 | else PostCaptchaForm) |
|
|||
125 |
|
124 | |||
126 | if request.method == 'POST': |
|
125 | if request.method == 'POST': | |
127 | form = postFormClass(request.POST, request.FILES, |
|
126 | form = postFormClass(request.POST, request.FILES, | |
128 | error_class=PlainErrorList) |
|
127 | error_class=PlainErrorList) | |
129 | if form.is_valid(): |
|
128 | if form.is_valid(): | |
130 | return _new_post(request, form, post_id) |
|
129 | return _new_post(request, form, post_id) | |
131 | else: |
|
130 | else: |
@@ -190,4 +190,6 b' THEMES = [' | |||||
190 | DEFAULT_THEME = 'md' |
|
190 | DEFAULT_THEME = 'md' | |
191 |
|
191 | |||
192 | POPULAR_TAGS = 10 |
|
192 | POPULAR_TAGS = 10 | |
193 | LAST_REPLIES_COUNT = 3 No newline at end of file |
|
193 | LAST_REPLIES_COUNT = 3 | |
|
194 | ||||
|
195 | ENABLE_CAPTCHA = True No newline at end of file |
@@ -106,32 +106,31 b'' | |||||
106 |
|
106 | |||
107 | <div class="form-title">{% trans "Create new thread" %}</div> |
|
107 | <div class="form-title">{% trans "Create new thread" %}</div> | |
108 | <div class="post-form"> |
|
108 | <div class="post-form"> | |
109 | <div class="form-row"> |
|
109 | <div class="form-row"> | |
110 | <div class="form-label">{% trans 'Title' %}</div> |
|
110 | <div class="form-label">{% trans 'Title' %}</div> | |
111 | <div class="form-input">{{ form.title }}</div> |
|
111 | <div class="form-input">{{ form.title }}</div> | |
112 | <div class="form-errors">{{ form.title.errors }}</div> |
|
112 | <div class="form-errors">{{ form.title.errors }}</div> | |
113 | </div> |
|
113 | </div> | |
114 | <div class="form-row"> |
|
114 | <div class="form-row"> | |
115 | <div class="form-label">{% trans 'Text' %}</div> |
|
115 | <div class="form-label">{% trans 'Text' %}</div> | |
116 | <div class="form-input">{{ form.text }}</div> |
|
116 | <div class="form-input">{{ form.text }}</div> | |
117 | <div class="form-errors">{{ form.text.errors }}</div> |
|
117 | <div class="form-errors">{{ form.text.errors }}</div> | |
118 | </div> |
|
118 | </div> | |
119 | <div class="form-row"> |
|
119 | <div class="form-row"> | |
120 | <div class="form-label">{% trans 'Image' %}</div> |
|
120 | <div class="form-label">{% trans 'Image' %}</div> | |
121 | <div class="form-input">{{ form.image }}</div> |
|
121 | <div class="form-input">{{ form.image }}</div> | |
122 | <div class="form-errors">{{ form.image.errors }}</div> |
|
122 | <div class="form-errors">{{ form.image.errors }}</div> | |
123 | </div> |
|
123 | </div> | |
124 | <div class="form-row"> |
|
124 | <div class="form-row"> | |
125 | <div class="form-label">{% trans 'Tags' %}</div> |
|
125 | <div class="form-label">{% trans 'Tags' %}</div> | |
126 | <div class="form-input">{{ form.tags }}</div> |
|
126 | <div class="form-input">{{ form.tags }}</div> | |
127 | <div class="form-errors">{{ form.tags.errors }}</div> |
|
127 | <div class="form-errors">{{ form.tags.errors }}</div> | |
128 | </div> |
|
128 | </div> | |
|
129 | <div class="form-row"> | |||
|
130 | {{ form.captcha }} | |||
|
131 | </div> | |||
129 | </div> |
|
132 | </div> | |
130 | <div class="form-submit"> |
|
133 | <div class="form-submit"> | |
131 | <BR /> |
|
|||
132 | {{ form.captcha }} |
|
|||
133 | <BR /> |
|
|||
134 |
|
||||
135 | <input type="submit" value="{% trans "Post" %}"/></div> |
|
134 | <input type="submit" value="{% trans "Post" %}"/></div> | |
136 | <div>Tags must be delimited by spaces. Text or image is required |
|
135 | <div>Tags must be delimited by spaces. Text or image is required | |
137 | </div> |
|
136 | </div> |
@@ -81,12 +81,11 b'' | |||||
81 | <div class="form-input">{{ form.image }}</div> |
|
81 | <div class="form-input">{{ form.image }}</div> | |
82 | <div class="form-errors">{{ form.image.errors }}</div> |
|
82 | <div class="form-errors">{{ form.image.errors }}</div> | |
83 | </div> |
|
83 | </div> | |
|
84 | <div class="form-row"> | |||
|
85 | {{ form.captcha }} | |||
|
86 | </div> | |||
84 | </div> |
|
87 | </div> | |
85 |
|
88 | |||
86 | <BR /> |
|
|||
87 | {{ form.captcha }} |
|
|||
88 | <BR /> |
|
|||
89 |
|
||||
90 | <div class="form-submit"><input type="submit" |
|
89 | <div class="form-submit"><input type="submit" | |
91 | value="{% trans "Post" %}"/></div> |
|
90 | value="{% trans "Post" %}"/></div> | |
92 | <div>Use <a |
|
91 | <div>Use <a |
General Comments 0
You need to be logged in to leave comments.
Login now