def create(request):
print('Hello')
filterstring = request.META['QUERY_STRING']
print(filterstring)
if request.method == 'POST':
form = Filter(request.POST)
if form.is_valid():
#use id for unique names
filter = FilterAnalysis.objects.create(user=request.user)
filter.name = request.POST['name']
filter.filterstring = form.cleaned_data['filterstring']
filter.save()
#return HttpResponseRedirect('/filter_analysis/?%s' % (filter.filterstring))
return redirect(reverse('filter_analysis')+'?'+filter.filterstring)
else:
form = Filter(initial={'filterstring': filterstring})
return render(request, 'filter_analysis/createfilter.html', {'form': form})
评论列表
文章目录