diff options
author | Jayaram Pai | 2014-04-23 17:18:27 +0530 |
---|---|---|
committer | Jayaram Pai | 2014-04-23 17:18:27 +0530 |
commit | 99bbf8ec16fca5eeec9d0ddad5f0a5ae169e4218 (patch) | |
tree | effff301f9792e9b02c266bd5a2fac055674a2b3 /website/views.py | |
parent | 8dd84484c4afa20d65a8232aba5a0e9931e7a749 (diff) | |
download | FOSSEE-Forum-99bbf8ec16fca5eeec9d0ddad5f0a5ae169e4218.tar.gz FOSSEE-Forum-99bbf8ec16fca5eeec9d0ddad5f0a5ae169e4218.tar.bz2 FOSSEE-Forum-99bbf8ec16fca5eeec9d0ddad5f0a5ae169e4218.zip |
changed slick in index page
changed login:next_url
modified the forms.py for initial value
Diffstat (limited to 'website/views.py')
-rw-r--r-- | website/views.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/website/views.py b/website/views.py index cd1665b..925fc2c 100644 --- a/website/views.py +++ b/website/views.py @@ -5,7 +5,7 @@ from django.shortcuts import render, get_object_or_404 from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_exempt from django.contrib.auth.decorators import login_required -from django.db.models import Q +from django.db.models import Q, Max from django.core.mail import EmailMultiAlternatives from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.contrib.auth import get_user_model @@ -217,6 +217,7 @@ def filter(request, category=None, tutorial=None, minute_range=None, second_ran @login_required def new_question(request): + context = {} if request.method == 'POST': form = NewQuestionForm(request.POST) if form.is_valid(): @@ -257,11 +258,12 @@ def new_question(request): return HttpResponseRedirect('/') else: - form = NewQuestionForm() - - context = { - 'form': form - } + #fix dirty code + category = request.GET.get('category') + form = NewQuestionForm(category=category) + context['category'] = category + + context['form'] = form context.update(csrf(request)) return render(request, 'website/templates/new-question.html', context) |