Esempio n. 1
0
 def post(self, request):
     formset = CategoryFormset(request.POST)
     if not formset.is_valid():
         category_list = CategoryView.create_category_list()
         return render(request, 'articles/category-form.html',
                 {'formset': formset, 'category_list': category_list})
     formset.save()
     return HttpResponseRedirect(reverse('articles:category'))
Esempio n. 2
0
 def post(self, request):
     formset = CategoryFormset(request.POST)
     if not formset.is_valid():
         category_list = CategoryView.create_category_list()
         return render(request, 'articles/category-form.html',
                 {'formset': formset, 'category_list': category_list})
     formset.save()
     return HttpResponseRedirect(reverse('articles:category'))
Esempio n. 3
0
 def get(self, request):
     category_list = CategoryView.create_category_list()
     formset = CategoryFormset()
     return render(request, 'articles/category-form.html', {
         'formset': formset,
         'category_list': category_list
     })