示例#1
0
def change_mall_announcement(request,**kwargs):
    """
    修改商城公告
    """
    template_name = "management/mall/mall_new_Announcement.html"
    a_id = request.GET.get("a_id")
    try:
        NoticeMall = notice_mall.objects.get(id = a_id)
    except:
        raise Http404
    
    if request.method == "POST":
        form = NoticeMallForm(request.POST,request.FILES,instance=NoticeMall)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect("/mall_notice/")
    else:
        form = NoticeMallForm(instance = NoticeMall)
        
    ctx = {
        "form":form,
        'change':True,
        'a_id':a_id
    }
    return render_to_response(template_name,RequestContext(request,ctx))
示例#2
0
def add_mall_notice(request, **kwargs):
    """
    添加商城公告
    """
    template_name = "management/mall/mall_new_Announcement.html"
    form = NoticeMallForm(request.POST,request.FILES)

    if form.is_valid():
        form.save()
        
        return HttpResponseRedirect("/mall_notice/")
    
    ctx = {
        'form':form
    }
    
    return render_to_response(template_name,RequestContext(request,ctx))