def feedback(request, store_id=1): if request.POST: form = ContactCommentOnlyForm(request.POST) if form.is_valid(): return JsonResponse({'success': True}) else: return JsonResponse({'error': form.errors}) return HttpResponse("Hello from feedback!")
def feedback(request,store_id=1): if request.POST: form = ContactCommentOnlyForm(request.POST) if form.is_valid(): return JsonResponse({'success':True}) else: return JsonResponse({'error':form.errors}) return HttpResponse("Hello from feedback!")
def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(StoreDetail, self).get_context_data(**kwargs) # Add ContactCommentOnlyForm to context form = ContactCommentOnlyForm() context['form'] = form return context
def detail(request, store_id=1): try: store = Store.objects.get(id=store_id) form = ContactCommentOnlyForm() vals_for_template = {'store': store, 'form': form} return render(request, 'stores/detail.html', vals_for_template) except Exception: raise Http404
def post(self, request): form = ContactCommentOnlyForm(request.POST) if form.is_valid(): return JsonResponse({'success': True}) else: return JsonResponse({'error': form.errors})
def post(self, request): form = ContactCommentOnlyForm(request.POST) if form.is_valid(): return JsonResponse({'success':True}) else: return JsonResponse({'error':form.errors})