def copy_snapshot(request, domain): user = request.couch_user if not user.is_eula_signed(): messages.error(request, 'You must agree to our eula to download an app') return project_info(request, domain) dom = Domain.get(domain) if request.method == "POST" and dom.is_snapshot: from corehq.apps.registration.forms import DomainRegistrationForm args = { 'domain_name': request.POST['new_project_name'], 'eula_confirmed': True } form = DomainRegistrationForm(args) if request.POST.get('new_project_name', ""): if not dom.published: messages.error( request, "This project is not published and can't be downloaded") return project_info(request, domain) if form.is_valid(): new_domain = dom.save_copy(form.cleaned_data['domain_name'], user=user) else: messages.error(request, form.errors) return project_info(request, domain) if new_domain is None: messages.error(request, _("A project by that name already exists")) return project_info(request, domain) def inc_downloads(d): d.downloads += 1 apply_update(dom, inc_downloads) # sign project up for trial create_30_day_trial(new_domain) messages.success(request, render_to_string( "appstore/partials/view_wiki.html", {"pre": _("Project copied successfully!")}), extra_tags="html") return HttpResponseRedirect( reverse('view_app', args=[ new_domain.name, new_domain.full_applications()[0].get_id ])) else: messages.error(request, _("You must specify a name for the new project")) return project_info(request, domain) else: return HttpResponseRedirect(reverse('project_info', args=[domain]))
def copy_snapshot(request, domain): user = request.couch_user if not user.is_eula_signed(): messages.error(request, 'You must agree to our eula to download an app') return project_info(request, domain) dom = Domain.get_by_name(domain) if request.method == "POST" and dom.is_snapshot: args = {'domain_name': request.POST['new_project_name'], 'eula_confirmed': True} form = DomainRegistrationForm(args) if request.POST.get('new_project_name', ""): if not dom.published: messages.error(request, "This project is not published and can't be downloaded") return project_info(request, domain) if form.is_valid(): new_domain = dom.save_copy(form.clean_domain_name(), user=user) else: messages.error(request, form.errors) return project_info(request, domain) if new_domain is None: messages.error(request, _("A project by that name already exists")) return project_info(request, domain) dom.downloads += 1 dom.save() messages.success(request, render_to_string("appstore/partials/view_wiki.html", {"pre": _("Project copied successfully!")}), extra_tags="html") return HttpResponseRedirect(reverse('view_app', args=[new_domain.name, new_domain.full_applications()[0].get_id])) else: messages.error(request, _("You must specify a name for the new project")) return project_info(request, domain) else: return HttpResponseRedirect(reverse('project_info', args=[domain]))
def register_domain(request, domain_type=None): domain_type = domain_type or 'commcare' assert domain_type in DOMAIN_TYPES _render = partial(render_registration_view, domain_type=domain_type) is_new = False referer_url = request.GET.get('referer', '') active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: vals = dict(requested_domain=domains_for_user[0]) return _render(request, 'registration/confirmation_waiting.html', { 'requested_domain': domains_for_user[0] }) if request.method == 'POST': nextpage = request.POST.get('next') org = request.POST.get('org') form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: vals = {'error_msg':'Number of domains requested today exceeds limit ('+str(max_req)+') - contact Dimagi', 'show_homepage_link': 1 } return _render(request, 'error.html', vals) request_new_domain( request, form, org, new_user=is_new, domain_type=domain_type) requested_domain = form.cleaned_data['domain_name'] if is_new: vals = dict(alert_message="An email has been sent to %s." % request.user.username, requested_domain=requested_domain) return _render(request, 'registration/confirmation_sent.html', vals) else: messages.success(request, '<strong>The project {project_name} was successfully created!</strong> An email has been sent to {username} for your records.'.format( username=request.user.username, project_name=requested_domain ), extra_tags="html") if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[requested_domain])) else: if nextpage: # messages.error(request, "The new project could not be created! Please make sure to fill out all fields of the form.") return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={'domain_type': domain_type}) return _render(request, 'registration/domain_request.html', { 'form': form, 'is_new': is_new, })
def copy_snapshot(request, snapshot): user = request.couch_user if not user.is_eula_signed(): messages.error(request, _('You must agree to our terms of service to download an app')) return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot])) domain_obj = Domain.get(snapshot) if request.method == "POST" and domain_obj.is_snapshot: assert domain_obj.full_applications(include_builds=False), 'Bad attempt to copy project without any apps!' from corehq.apps.registration.forms import DomainRegistrationForm args = { 'domain_name': request.POST['new_project_name'], 'hr_name': request.POST['new_project_name'], 'eula_confirmed': True, } form = DomainRegistrationForm(args) if request.POST.get('new_project_name', ""): if not domain_obj.published: messages.error(request, _("This project is not published and can't be downloaded")) return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot])) if not form.is_valid(): messages.error(request, form.errors) return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot])) new_domain_name = name_to_url(form.cleaned_data['hr_name'], "project") with CriticalSection(['copy_domain_snapshot_{}_to_{}'.format(domain_obj.name, new_domain_name)]): try: new_domain = domain_obj.save_copy(new_domain_name, new_hr_name=form.cleaned_data['hr_name'], user=user) if new_domain.commtrack_enabled: new_domain.convert_to_commtrack() ensure_explicit_community_subscription( new_domain.name, date.today(), SubscriptionAdjustmentMethod.USER, web_user=user.username, ) except NameUnavailableException: messages.error(request, _("A project by that name already exists")) return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot])) def inc_downloads(d): d.downloads += 1 apply_update(domain_obj, inc_downloads) messages.success(request, render_to_string("appstore/partials/view_wiki.html", {"pre": _("Project copied successfully!")}), extra_tags="html") return HttpResponseRedirect(reverse('view_app', args=[new_domain.name, new_domain.full_applications()[0].get_id])) else: messages.error(request, _("You must specify a name for the new project")) return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot])) else: return HttpResponseRedirect(reverse(ProjectInformationView.urlname, args=[snapshot]))
def post(self, request, *args, **kwargs): referer_url = request.GET.get('referer', '') nextpage = request.POST.get('next') form = DomainRegistrationForm(request.POST) context = self.get_context_data(form=form) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'current_page': { 'page_name': _('Oops!') }, 'error_msg': _('Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) try: domain_name = request_new_domain(request, form, is_new_user=self.is_new_user) except NameUnavailableException: context.update({ 'current_page': { 'page_name': _('Oops!') }, 'error_msg': _('Project name already taken - please try another'), 'show_homepage_link': 1 }) return render(request, 'error.html', context) if self.is_new_user: context.update({ 'requested_domain': domain_name, 'current_page': { 'page_name': _('Confirm Account') }, }) track_workflow(self.request.user.email, "Created new project") return render(request, 'registration/confirmation_sent.html', context) else: if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect( reverse("domain_homepage", args=[domain_name])) return self.render_to_response(context)
def copy_snapshot(request, domain): user = request.couch_user if not user.is_eula_signed(): messages.error(request, 'You must agree to our eula to download an app') return project_info(request, domain) dom = Domain.get(domain) if request.method == "POST" and dom.is_snapshot: assert dom.full_applications(include_builds=False), 'Bad attempt to copy project without any apps!' from corehq.apps.registration.forms import DomainRegistrationForm args = { 'domain_name': request.POST['new_project_name'], 'hr_name': request.POST['new_project_name'], 'eula_confirmed': True, } form = DomainRegistrationForm(args) if request.POST.get('new_project_name', ""): if not dom.published: messages.error(request, _("This project is not published and can't be downloaded")) return project_info(request, domain) if not form.is_valid(): messages.error(request, form.errors) return project_info(request, domain) new_domain_name = name_to_url(form.cleaned_data['hr_name'], "project") with CriticalSection(['copy_domain_snapshot_{}_to_{}'.format(dom.name, new_domain_name)]): try: new_domain = dom.save_copy(new_domain_name, new_hr_name=form.cleaned_data['hr_name'], user=user) except NameUnavailableException: messages.error(request, _("A project by that name already exists")) return project_info(request, domain) # sign new project up for trial create_30_day_trial(new_domain) def inc_downloads(d): d.downloads += 1 apply_update(dom, inc_downloads) messages.success(request, render_to_string("appstore/partials/view_wiki.html", {"pre": _("Project copied successfully!")}), extra_tags="html") return HttpResponseRedirect(reverse('view_app', args=[new_domain.name, new_domain.full_applications()[0].get_id])) else: messages.error(request, _("You must specify a name for the new project")) return project_info(request, domain) else: return HttpResponseRedirect(reverse('project_info', args=[domain]))
def post(self, request, *args, **kwargs): referer_url = request.GET.get('referer', '') nextpage = request.POST.get('next') form = DomainRegistrationForm(request.POST) context = self.get_context_data(form=form) if not form.is_valid(): return self.render_to_response(context) if settings.RESTRICT_DOMAIN_CREATION and not request.user.is_superuser: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _('Your organization has requested that project creation be restricted. ' 'For more information, please speak to your administrator.'), }) return render(request, 'error.html', context) reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _( 'Number of projects requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) try: domain_name = request_new_domain(request, form, is_new_user=self.is_new_user) except NameUnavailableException: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _('Project name already taken - please try another'), 'show_homepage_link': 1 }) return render(request, 'error.html', context) if self.is_new_user: context.update({ 'requested_domain': domain_name, 'current_page': {'page_name': _('Confirm Account')}, }) track_workflow(self.request.user.email, "Created new project") return render(request, 'registration/confirmation_sent.html', context) if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[domain_name]))
def copy_snapshot(request, domain): dom = Domain.get_by_name(domain) if request.method == "POST" and dom.is_snapshot: args = {'domain_name': request.POST['new_project_name'], 'tos_confirmed': True} form = DomainRegistrationForm(args) if form.is_valid(): new_domain = dom.save_copy(form.clean_domain_name(), user=request.couch_user) else: messages.error(request, form.errors) return project_info(request, domain) if new_domain is None: messages.error(request, "A project by that name already exists") return project_info(request, domain) messages.success(request, "Project copied successfully!") return redirect("domain_project_settings", new_domain.name)
def post(self, request, *args, **kwargs): referer_url = request.GET.get('referer', '') nextpage = request.POST.get('next') form = DomainRegistrationForm(request.POST, current_user=request.couch_user) context = self.get_context_data(form=form) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _( 'Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) try: domain_name = request_new_domain( request, form, is_new_user=self.is_new_user) except NameUnavailableException: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _('Project name already taken - please try another'), 'show_homepage_link': 1 }) return render(request, 'error.html', context) if self.is_new_user: context.update({ 'requested_domain': domain_name, 'track_domain_registration': True, 'current_page': {'page_name': _('Confirm Account')}, }) return render(request, 'registration/confirmation_sent.html', context) else: if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[domain_name])) return self.render_to_response(context)
def register_domain(request, domain_type=None): domain_type = domain_type or 'commcare' assert domain_type in DOMAIN_TYPES context = get_domain_context(domain_type) is_new = False referer_url = request.GET.get('referer', '') active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: context['requested_domain'] = domains_for_user[0] return render(request, 'registration/confirmation_waiting.html', context) if request.method == 'POST': nextpage = request.POST.get('next') org = request.POST.get('org') form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'error_msg': _('Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) request_new_domain(request, form, org, new_user=is_new, domain_type=domain_type) requested_domain = form.cleaned_data['domain_name'] if is_new: context.update({ 'alert_message': _("An email has been sent to %s.") % request.user.username, 'requested_domain': requested_domain }) return render(request, 'registration/confirmation_sent.html', context) else: messages.success( request, _('<strong>The project {project} was successfully created!</strong> ' 'An email has been sent to {user} for your records.' ).format(project=requested_domain, user=request.user.username), extra_tags="html") if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect( reverse("domain_homepage", args=[requested_domain])) else: if nextpage: return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={'domain_type': domain_type}) context.update({ 'form': form, 'is_new': is_new, }) return render(request, 'registration/domain_request.html', context)
def register_domain(request, domain_type=None): domain_type = domain_type or 'commcare' if domain_type not in DOMAIN_TYPES or request.couch_user.is_commcare_user(): raise Http404() context = get_domain_context(domain_type) is_new = False referer_url = request.GET.get('referer', '') active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: context['requested_domain'] = domains_for_user[0] return render(request, 'registration/confirmation_waiting.html', context) if request.method == 'POST': nextpage = request.POST.get('next') org = request.POST.get('org') form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'error_msg': _( 'Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) request_new_domain( request, form, org, new_user=is_new, domain_type=domain_type) requested_domain = form.cleaned_data['domain_name'] if is_new: context.update({ 'alert_message': _("An email has been sent to %s.") % request.user.username, 'requested_domain': requested_domain }) return render(request, 'registration/confirmation_sent.html', context) else: messages.success(request, _( '<strong>The project {project} was successfully created!</strong> ' 'An email has been sent to {user} for your records.').format( project=requested_domain, user=request.user.username), extra_tags="html") if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[requested_domain])) else: if nextpage: return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={'domain_type': domain_type}) context.update({ 'form': form, 'is_new': is_new, }) return render(request, 'registration/domain_request.html', context)
def register_domain(request, domain_type=None): domain_type = domain_type or 'commcare' if domain_type not in DOMAIN_TYPES or (not request.couch_user) or request.couch_user.is_commcare_user(): raise Http404() context = get_domain_context(domain_type) is_new = False referer_url = request.GET.get('referer', '') active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: context['requested_domain'] = domains_for_user[0] return render(request, 'registration/confirmation_waiting.html', context) if request.method == 'POST': nextpage = request.POST.get('next') org = request.POST.get('org') form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'error_msg': _( 'Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) try: domain_name = request_new_domain( request, form, org, new_user=is_new, domain_type=domain_type) except NameUnavailableException: context.update({ 'error_msg': _('Project name already taken - please try another'), 'show_homepage_link': 1 }) return render(request, 'error.html', context) if is_new: context.update({ 'alert_message': _("An email has been sent to %s.") % request.user.username, 'requested_domain': domain_name, 'track_domain_registration': True, }) return render(request, 'registration/confirmation_sent.html', context) else: if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[domain_name])) else: if nextpage: return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={'domain_type': domain_type}) context.update({ 'form': form, 'is_new': is_new, }) return render(request, 'registration/domain_request.html', context)
def register_domain(request, domain_type=None): domain_type = domain_type or "commcare" assert domain_type in DOMAIN_TYPES context = get_domain_context(domain_type) is_new = False referer_url = request.GET.get("referer", "") active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: context["requested_domain"] = domains_for_user[0] return render(request, "registration/confirmation_waiting.html", context) if request.method == "POST": nextpage = request.POST.get("next") org = request.POST.get("org") form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update( { "error_msg": _("Number of domains requested today exceeds limit (%d) - contact Dimagi") % max_req, "show_homepage_link": 1, } ) return render(request, "error.html", context) request_new_domain(request, form, org, new_user=is_new, domain_type=domain_type) requested_domain = form.cleaned_data["domain_name"] if is_new: context.update( { "alert_message": _("An email has been sent to %s.") % request.user.username, "requested_domain": requested_domain, } ) return render(request, "registration/confirmation_sent.html", context) else: messages.success( request, _( "<strong>The project {project} was successfully created!</strong> " "An email has been sent to {user} for your records." ).format(project=requested_domain, user=request.user.username), extra_tags="html", ) if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect(reverse("domain_homepage", args=[requested_domain])) else: if nextpage: return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={"domain_type": domain_type}) context.update({"form": form, "is_new": is_new}) return render(request, "registration/domain_request.html", context)
def copy_snapshot(request, domain): user = request.couch_user if not user.is_eula_signed(): messages.error(request, 'You must agree to our eula to download an app') return project_info(request, domain) dom = Domain.get(domain) if request.method == "POST" and dom.is_snapshot: assert dom.full_applications( include_builds=False ), 'Bad attempt to copy project without any apps!' from corehq.apps.registration.forms import DomainRegistrationForm args = { 'domain_name': request.POST['new_project_name'], 'hr_name': request.POST['new_project_name'], 'eula_confirmed': True, } form = DomainRegistrationForm(args) if request.POST.get('new_project_name', ""): if not dom.published: messages.error( request, _("This project is not published and can't be downloaded")) return project_info(request, domain) if not form.is_valid(): messages.error(request, form.errors) return project_info(request, domain) new_domain_name = form.cleaned_data['hr_name'] with CriticalSection([ 'copy_domain_snapshot_{}_to_{}'.format( dom.name, new_domain_name) ]): try: new_domain = dom.save_copy( new_domain_name, new_hr_name=form.cleaned_data['hr_name'], user=user) except NameUnavailableException: messages.error(request, _("A project by that name already exists")) return project_info(request, domain) # sign new project up for trial create_30_day_trial(new_domain) def inc_downloads(d): d.downloads += 1 apply_update(dom, inc_downloads) messages.success(request, render_to_string( "appstore/partials/view_wiki.html", {"pre": _("Project copied successfully!")}), extra_tags="html") return HttpResponseRedirect( reverse('view_app', args=[ new_domain.name, new_domain.full_applications()[0].get_id ])) else: messages.error(request, _("You must specify a name for the new project")) return project_info(request, domain) else: return HttpResponseRedirect(reverse('project_info', args=[domain]))
def register_domain(request, domain_type=None): domain_type = domain_type or 'commcare' if domain_type not in DOMAIN_TYPES or request.couch_user.is_commcare_user( ): raise Http404() context = get_domain_context(domain_type) is_new = False referer_url = request.GET.get('referer', '') active_domains_for_user = Domain.active_for_user(request.user) if len(active_domains_for_user) <= 0 and not request.user.is_superuser: is_new = True domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(domains_for_user) > 0: context['requested_domain'] = domains_for_user[0] return render(request, 'registration/confirmation_waiting.html', context) if request.method == 'POST': nextpage = request.POST.get('next') org = request.POST.get('org') form = DomainRegistrationForm(request.POST) if form.is_valid(): reqs_today = RegistrationRequest.get_requests_today() max_req = settings.DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY if reqs_today >= max_req: context.update({ 'error_msg': _('Number of domains requested today exceeds limit (%d) - contact Dimagi' ) % max_req, 'show_homepage_link': 1 }) return render(request, 'error.html', context) try: domain_name = request_new_domain(request, form, org, new_user=is_new, domain_type=domain_type) except NameUnavailableException: context.update({ 'error_msg': _('Project name already taken - please try another'), 'show_homepage_link': 1 }) return render(request, 'error.html', context) if is_new: context.update({ 'alert_message': _("An email has been sent to %s.") % request.user.username, 'requested_domain': domain_name, 'track_domain_registration': True, }) return render(request, 'registration/confirmation_sent.html', context) else: if nextpage: return HttpResponseRedirect(nextpage) if referer_url: return redirect(referer_url) return HttpResponseRedirect( reverse("domain_homepage", args=[domain_name])) else: if nextpage: return orgs_landing(request, org, form=form) else: form = DomainRegistrationForm(initial={'domain_type': domain_type}) context.update({ 'form': form, 'is_new': is_new, }) return render(request, 'registration/domain_request.html', context)