def edit_organizer(request, bbl=None, id=None): lot = get_object_or_404(Lot, bbl=bbl) organizer = get_object_or_404(Organizer, id=id) if request.method == 'POST': form = OrganizerForm(request.POST, instance=organizer) if form.is_valid(): organizer = form.save() return redirect('lots.views.details', bbl=bbl) else: form = OrganizerForm(instance=organizer) return render_to_response('organize/edit_organizer.html', { 'form': form, 'lot': lot, }, context_instance=RequestContext(request))
def add_organizer(request, bbl=None): lot = get_object_or_404(Lot, bbl=bbl) if request.method == 'POST': form = OrganizerForm(request.POST) if form.is_valid(): organizer = form.save() return redirect('lots.views.details', bbl=bbl) else: form = OrganizerForm(initial={ 'lot': lot, }) template = 'organize/add_organizer.html' return render_to_response(template, { 'form': form, 'lot': lot, }, context_instance=RequestContext(request))
def add_organizer(request, bbl=None): lot = get_object_or_404(Lot, bbl=bbl) if request.method == 'POST': form = OrganizerForm(request.POST, user=request.user) if form.is_valid(): organizer = form.save() return redirect('organize_organizer_add_success', bbl=bbl, email_hash=organizer.email_hash[:10]) else: form = OrganizerForm(initial={ 'lot': lot, }, user=request.user) template = 'organize/add_organizer.html' return render_to_response(template, { 'form': form, 'lot': lot, }, context_instance=RequestContext(request))