def edit_show(request, show_id):
    from market_buy.models import Show
    from market_buy.forms import ShowForm

    shop = request.shop
    show = get_object_or_404(Show, pk=show_id)
    if show.owner != request.user:
        return HttpResponseForbidden("Not allowed")

    if request.method == "POST":
        form = ShowForm(request.POST, instance=show)
        if form.is_valid():
            show = form.save(commit=False)
            show.marketplace = shop.marketplace
            show.owner = shop.admin
            show.save()

            request.flash["message"] = "Show edited"
            request.flash["severity"] = "success"
            return HttpResponseRedirect(reverse("web_store_shows"))
    else:
        form = ShowForm(instance=show)

    params = {"form": form}
    return render_to_response("store_admin/web_store/show_edit.html", params, RequestContext(request))
def edit_show(request, show_id):
    from market_buy.models import Show
    from market_buy.forms import ShowForm
    shop = request.shop
    show = get_object_or_404(Show, pk=show_id)
    if show.owner != request.user:
        return HttpResponseForbidden('Not allowed')

    if request.method == "POST":
        form = ShowForm(request.POST, instance=show)
        if form.is_valid():
            show = form.save(commit=False)
            show.marketplace = shop.marketplace
            show.owner = shop.admin
            show.save()

            request.flash['message'] = "Show edited"
            request.flash['severity'] = "success"
            return HttpResponseRedirect(reverse('web_store_shows'))
    else:
        form = ShowForm(instance=show)

    params = {'form': form}
    return render_to_response("store_admin/web_store/show_edit.html", params,
                              RequestContext(request))
def add_show(request):
    from market_buy.models import Show
    from market_buy.forms import ShowForm
    from shops.models import DealerToShow

    shop = request.shop

    if request.method == "POST":
        form = ShowForm(request.POST)
        if form.is_valid():

            show = form.save(commit=False)
            show.marketplace = shop.marketplace
            show.owner = shop.admin
            show.create(shop)

            request.flash['message'] = "Show added"
            request.flash['severity'] = "success"
            return HttpResponseRedirect(reverse('web_store_shows'))
    else:
        form = ShowForm()

    params = {'form': form}
    return render_to_response("store_admin/web_store/show_add.html", params,
                              RequestContext(request))
Beispiel #4
0
def add_show(request):
    from market_buy.models import Show
    from market_buy.forms import ShowForm
    shop = request.shop
    
    if request.method == "POST":
        form = ShowForm(request.POST)
        if form.is_valid():
            
            show = form.save(commit = False)
            show.marketplace = shop.marketplace
            show.save()
            
            request.flash['message'] = "Show added"
            request.flash['severity'] = "success"
            return HttpResponseRedirect(reverse('web_store_shows'))
    else:
        form = ShowForm()
    
    params = {'form' : form}
    return render_to_response("store_admin/web_store/show_add.html", params, RequestContext(request))
def add_show(request):
    from market_buy.models import Show
    from market_buy.forms import ShowForm
    from shops.models import DealerToShow

    shop = request.shop

    if request.method == "POST":
        form = ShowForm(request.POST)
        if form.is_valid():

            show = form.save(commit=False)
            show.marketplace = shop.marketplace
            show.owner = shop.admin
            show.create(shop)

            request.flash["message"] = "Show added"
            request.flash["severity"] = "success"
            return HttpResponseRedirect(reverse("web_store_shows"))
    else:
        form = ShowForm()

    params = {"form": form}
    return render_to_response("store_admin/web_store/show_add.html", params, RequestContext(request))