예제 #1
0
파일: views.py 프로젝트: Justwmz/restindoor
def newContact(request):
    formCont = ContactForm(request.POST or None)
    if formCont.is_valid():
        formCont.save()
        error(request, 'Информация о контакте успешно добавлена.')
        return redirect('contact-index')
    var = {'formCont': formCont}

    return render_to_response('restaurant/contact/edit.html', var, context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: Justwmz/restindoor
def editContact(request, id):
    contact = Contact.objects.get(id=id)
    formCont = ContactForm(request.POST or None, instance=contact)
    if formCont.is_valid():
        formCont.save()
        error(request, 'Информация о контакте успешно изменена.')
        return redirect('contact-index')
    var = {'contact': contact, 'formCont': formCont}

    return render_to_response('restaurant/contact/edit.html', var, context_instance=RequestContext(request))