def update_event(request,id): check_user(request) user_profile = get_user_profile(request) if request.method == 'POST': event_to_update = Event.objects.get(pk=id) form = EventDetailsForm(request.POST or None,instance=event_to_update) if form.is_valid(): print "Able to update" form.save() else: print form.errors return view_all_events(request)
def add_new_event(request): check_user(request) user_profile = get_user_profile(request) if request.method == 'POST': form = EventDetailsForm(request.POST) if form.is_valid(): print 'form is valid! here' form.save() #return redirect('login') else: print form.errors return view_all_events(request)