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)