diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2012-03-06 13:36:56 -0600 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2012-03-06 13:36:56 -0600 |
commit | 19a69cd3d9ed2654edd5050f0ccfa66bea20da87 (patch) | |
tree | 783be6ecbf509b6064ddf5dbf427882a4342d66b | |
parent | fafc737789dd33265dfbe7ff7d1a0c4261269133 (diff) | |
parent | 408153397de074b7fc7f13e14468559016877160 (diff) | |
download | askbot-19a69cd3d9ed2654edd5050f0ccfa66bea20da87.tar.gz askbot-19a69cd3d9ed2654edd5050f0ccfa66bea20da87.tar.bz2 askbot-19a69cd3d9ed2654edd5050f0ccfa66bea20da87.zip |
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r-- | askbot/forms.py | 8 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/answer_tab_bar.html | 2 | ||||
-rw-r--r-- | askbot/views/readers.py | 1 | ||||
-rw-r--r-- | askbot/views/writers.py | 17 |
4 files changed, 21 insertions, 7 deletions
diff --git a/askbot/forms.py b/askbot/forms.py index 4b72180c..8c5fd082 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -106,6 +106,8 @@ class TitleField(forms.CharField): self.initial = '' def clean(self, value): + if value is None: + value = '' if len(value) < askbot_settings.MIN_TITLE_LENGTH: msg = ungettext_lazy( 'title must be > %d character', @@ -149,6 +151,8 @@ class EditorField(forms.CharField): self.initial = '' def clean(self, value): + if value is None: + value = '' if len(value) < self.min_length: msg = ungettext_lazy( self.length_error_template_singular, @@ -248,7 +252,9 @@ class TagNamesField(forms.CharField): #todo - this needs to come from settings tagname_re = re.compile(const.TAG_REGEX, re.UNICODE) if not tagname_re.search(tag): - raise forms.ValidationError(_('use-these-chars-in-tags')) + raise forms.ValidationError(_( + 'In tags, please use letters, numbers and characters "-+.#"' + )) #only keep unique tags if tag not in entered_tags: entered_tags.append(tag) diff --git a/askbot/skins/default/templates/question/answer_tab_bar.html b/askbot/skins/default/templates/question/answer_tab_bar.html index 632c0cf2..bebf68b8 100644 --- a/askbot/skins/default/templates/question/answer_tab_bar.html +++ b/askbot/skins/default/templates/question/answer_tab_bar.html @@ -1,6 +1,6 @@ <div class="tabBar tabBar-answer"> <h2 id="questionCount"> - {% trans counter=answers|length %} + {% trans counter=answer_count %} {{counter}} Answer {% pluralize %} {{counter}} Answers diff --git a/askbot/views/readers.py b/askbot/views/readers.py index 6ad69aa3..5ff7889d 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -533,6 +533,7 @@ def question(request, id):#refactor - long subroutine. display question body, an 'thread': thread, 'answer' : answer_form, 'answers' : page_objects.object_list, + 'answer_count': len(answers), 'user_votes': user_votes, 'user_post_id_list': user_post_id_list, 'user_can_post_comment': user_can_post_comment,#in general diff --git a/askbot/views/writers.py b/askbot/views/writers.py index ab7f581e..0ee4b7ef 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -216,8 +216,8 @@ def ask(request):#view used to ask a new question user can start posting a question anonymously but then must login/register in order for the question go be shown """ - if request.method == "POST": - form = forms.AskForm(request.POST) + form = forms.AskForm(request.REQUEST) + if request.method == 'POST': if form.is_valid(): timestamp = datetime.datetime.now() title = form.cleaned_data['title'] @@ -257,10 +257,17 @@ def ask(request):#view used to ask a new question ip_addr = request.META['REMOTE_ADDR'], ) return HttpResponseRedirect(url_utils.get_login_url()) - else: + + if request.method == 'GET': form = forms.AskForm() - if 'title' in request.GET: # prepopulate title (usually from search query on main page) - form.initial['title'] = request.GET['title'] + + form.initial = { + 'title': request.REQUEST.get('title', ''), + 'text': request.REQUEST.get('text', ''), + 'tags': request.REQUEST.get('tags', ''), + 'wiki': request.REQUEST.get('wiki', False), + 'is_anonymous': request.REQUEST.get('is_anonymous', False), + } data = { 'active_tab': 'ask', |