Пример #1
0
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!")
Пример #2
0
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!")
Пример #3
0
 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
Пример #4
0
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
Пример #5
0
 def post(self, request):
     form = ContactCommentOnlyForm(request.POST)
     if form.is_valid():
         return JsonResponse({'success': True})
     else:
         return JsonResponse({'error': form.errors})
Пример #6
0
 def post(self, request):
     form = ContactCommentOnlyForm(request.POST)
     if form.is_valid():
         return JsonResponse({'success':True})
     else:
         return JsonResponse({'error':form.errors})