def edit(request, organization_id): if is_admin(request): organization = None if organization_id: organization = get_organization_by_id(organization_id) if request.method == 'POST': form = OrganizationForm(request.POST, instance=organization) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('organization:list')) else: return render( request, 'organization/edit.html', {'form': form, } ) else: form = OrganizationForm(instance=organization) return render( request, 'organization/edit.html', {'form': form, } ) else: return render(request, 'vms/no_admin_rights.html')
def create(request): if request.method == 'POST': form = OrganizationForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('organization:list')) else: return render(request, 'organization/create.html', {'form' : form,}) else: form = OrganizationForm() return render(request, 'organization/create.html', {'form' : form,})
def create(request): if request.method == 'POST': form = OrganizationForm(request.POST) if form.is_valid(): form.save() return render(request, 'organization/create_success.html') else: return render(request, 'organization/create.html', {'form' : form,}) else: form = OrganizationForm() return render(request, 'organization/create.html', {'form' : form,})
def create(request): if request.method == 'POST': form = OrganizationForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('organization:list')) else: return render(request, 'organization/create.html', { 'form': form, }) else: form = OrganizationForm() return render(request, 'organization/create.html', { 'form': form, })
def edit(request, organization_id): organization = None if organization_id: organization = get_organization_by_id(organization_id) if request.method == 'POST': form = OrganizationForm(request.POST, instance=organization) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('organization:list')) else: return render(request, 'organization/edit.html', { 'form': form, }) else: form = OrganizationForm(instance=organization) return render(request, 'organization/edit.html', { 'form': form, })