From b42fe64e3ad0ec80561b3b35d439e3feee59aaa8 Mon Sep 17 00:00:00 2001 From: Vitor Freitas Date: Wed, 12 Feb 2014 12:10:40 -0200 Subject: [PATCH] removing short name from review creating to keep things clear --- reviews/templates/reviews/new.html | 11 +---------- reviews/templates/reviews/settings.html | 2 ++ reviews/views.py | 13 +++---------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/reviews/templates/reviews/new.html b/reviews/templates/reviews/new.html index 80bfb7ac..8f21de20 100644 --- a/reviews/templates/reviews/new.html +++ b/reviews/templates/reviews/new.html @@ -4,16 +4,6 @@

Create a New Review

{% csrf_token %} -
-
- -
-
- - The name will be used to create a unique url for your review. Make sure you choose something short and elegant. - It will look like http://parsif.al/{{user.username}}/effort-estimation/ -
-
@@ -28,6 +18,7 @@

Create a New Review

+ Try to keep it short, max 500 characters :)
diff --git a/reviews/templates/reviews/settings.html b/reviews/templates/reviews/settings.html index c9d59812..0078b913 100644 --- a/reviews/templates/reviews/settings.html +++ b/reviews/templates/reviews/settings.html @@ -16,6 +16,8 @@

Settings

+ The name will be used to create a unique url for your review. Make sure you choose something short and elegant. + It will look like http://parsif.al/{{user.username}}/example-review-name/
diff --git a/reviews/views.py b/reviews/views.py index 77b5e48a..f2a4b958 100644 --- a/reviews/views.py +++ b/reviews/views.py @@ -26,26 +26,19 @@ def reviews(request, username): def new(request): review = Review() if request.method == 'POST': - name = request.POST['name'] title = request.POST['title'] description = request.POST['description'] author = request.user - - name = ' '.join(name.split()) # remove random spaces between words + name = ' '.join(title.split()) # remove random spaces between words name = name.replace(' ', '-').lower() review = Review(name = name, title = title, description = description, author=author) - - if name and title: + if title: review.save() messages.add_message(request, messages.SUCCESS, 'Review created with success.') return redirect('/' + review.author.username + '/' + review.name + '/') else: - fields = [] - if not name: fields.append('Short Name') - if not title: fields.append('Title') - message = 'The following fields are required: ' + ', '.join(fields) + '.' + message = 'Title is a required field.' messages.add_message(request, messages.ERROR, message) - context = RequestContext(request, {'review': review}) return render_to_response('reviews/new.html', context)