def post(self, request): app_id = request.GET.get('id') app = get_object_or_404(ExhibitApplication, id=app_id) form = ExhibitApplicationForm( request.POST, request.FILES, instance=app) if not form.is_valid(): return render(request, 'campus_field/exhibit/form.html', {'form': form, 'app_id': app_id, 'post_url': \ reverse('exhibit:modify')+'?id='+app_id}) form.save() return HttpResponseRedirect(reverse('exhibit:manage'))
def post(self, request): app_id = request.GET.get('id') app = get_object_or_404(ExhibitApplication, id=app_id) form = ExhibitApplicationForm(request.POST, request.FILES, instance=app) if not form.is_valid(): return render(request, 'campus_field/exhibit/form.html', {'form': form, 'app_id': app_id, 'post_url': \ reverse('exhibit:modify')+'?id='+app_id}) form.save() return HttpResponseRedirect(reverse('exhibit:manage'))
def post(self, request): form = ExhibitApplicationForm(request.POST, request.FILES) if not form.is_valid(): return render(request, 'campus_field/exhibit/form.html', { 'form': form, 'post_url': reverse('exhibit:apply') }) app = form.save(commit=False) app.organization = request.user.organization app.save() return HttpResponseRedirect(reverse('exhibit:manage'))
def post(self, request): form = ExhibitApplicationForm(request.POST, request.FILES) if not form.is_valid(): return render(request, 'campus_field/exhibit/form.html', {'form': form, 'post_url': reverse('exhibit:apply')}) app = form.save(commit=False) app.organization = request.user.organization app.save() return HttpResponseRedirect(reverse('exhibit:manage'))