With both `redirect_field_name` and `redirect_field_value` available in
        the context, add on a querystring to handle "next" redirecting.
507240
def add_next(self, url, context):
        
        if all([key in context for key in ["redirect_field_name", "redirect_field_value"]]):
            if context["redirect_field_value"]:
                url += "?" + urlencode({
                    context["redirect_field_name"]: context["redirect_field_value"],
                })
        return url
179194
private function AddUrlField()
    {
        $name = 'Url';
        $this->AddField(Input::Text($name, $this->page->GetUrl()));
        $this->SetRequired($name);
        $this->AddValidator($name, DatabaseCount::UniqueFieldAnd($this->page, $name, $this->SiteCondition()));
    }
987817
def querystring_update(request, **kwargs):
    
    updated = request.GET.copy()
    for k, v in kwargs.items():
        updated[k] = v

    return updated.urlencode()
317945
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.query, name, field)
485159
def login(request, template_name=None,
          redirect_field_name=REDIRECT_FIELD_NAME,
          authentication_form=AuthenticationForm,
          current_app=None, extra_context=None):
    
    redirect_to = request.POST.get(
        redirect_field_name,
        request.GET.get(redirect_field_name, '')
    )

    def get_redirect_to():
        # Ensure the user-originating redirection url is safe.
        if not is_safe_url(url=redirect_to, host=request.get_host()):
            return resolve_url(settings.LOGIN_REDIRECT_URL)
        return redirect_to

    if request.user.is_authenticated:
        return HttpResponseRedirect(get_redirect_to())

    if request.method == "POST":
        form = authentication_form(request=request, data=request.POST)
        if form.is_valid():

            # Okay, security check complete. Log the user in.
            auth_login(request, form.get_user())

            return HttpResponseRedirect(get_redirect_to())
    else:
        form = authentication_form(request=request)

    current_site = get_current_site(request)

    context = {
        'form': form,
        redirect_field_name: redirect_to,
        'site': current_site,
        'site_name': current_site.name,
    }
    if extra_context is not None:
        context.update(extra_context)

    if current_app is not None:
        request.current_app = current_app

    return TemplateResponse(request, template_name, context)
261531
def url_replace(context, field, value):
    

    query_string = context['request'].GET.copy()
    query_string[field] = value

    return query_string.urlencode()
332718
protected function deleteFieldValue()
    {
        $this->controlAccess('field_value_delete');

        if ($this->field_value->delete($this->data_field_value['field_value_id'])) {
            $url = "admin/content/field/value/{$this->data_field['field_id']}";
            $this->redirect($url, $this->text('Field value has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Field value has not been deleted'), 'warning');
    }
1331868
def add_view(self, request, **kwargs):
        
        try:
            return super(ClonedRepoAdmin, self).add_view(request, **kwargs)
        except ValidationError:
            # Rerender the form, having messaged the user.
            return redirect(request.path)
633446
public function action_template_redirect() {
		add_filter( 'template_include', array( $this, 'filter_template_include' ), PHP_INT_MAX );

		foreach ( self::get_query_template_names() as $template => $conditional ) {

			// If a matching theme-compat file is found, further conditional checks won't occur in template-loader.php
			if ( $this->got_theme_compat ) {
				break;
			}

			$get_template = "get_{$template}_template";

			if ( function_exists( $conditional ) && function_exists( $get_template ) && call_user_func( $conditional ) ) {
				$filter = str_replace( '_', '', $template );
				add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
				call_user_func( $get_template );
				remove_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
			}
		}

	}
672925
def options(self, url: StrOrURL, *, allow_redirects: bool=True,
                **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(
            self._request(hdrs.METH_OPTIONS, url,
                          allow_redirects=allow_redirects,
                          **kwargs))
363772
def get_redirect_url(self, request, callback, parameters=None):
        """"""
        args = self.get_redirect_args(request, callback=callback)
        additional = parameters or {}
        args.update(additional)
        params = urlencode(args)
        return '{0}?{1}'.format(self.authorization_url, params)
246035
def parse_querystring(self, req: Request, name: str, field: Field) -> typing.Any:
        """"""
        return core.get_value(req.query, name, field)
203774
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.GET, name, field)
636725
def get_default_redirect(self, rule, method, values, query_args):
        
        assert self.map.redirect_defaults
        for r in self.map._rules_by_endpoint[rule.endpoint]:
            # every rule that comes after this one, including ourself
            # has a lower priority for the defaults.  We order the ones
            # with the highest priority up for building.
            if r is rule:
                break
            if r.provides_defaults_for(rule) and r.suitable_for(values, method):
                values.update(r.defaults)
                domain_part, path = r.build(values)
                return self.make_redirect_url(path, query_args, domain_part=domain_part)
1323931
def _redirect_url(request):
    

    next = request.GET.get(REDIRECT_FIELD_NAME)

    if not next:
        if settings.CAS_IGNORE_REFERER:
            next = settings.CAS_REDIRECT_URL
        else:
            next = request.META.get('HTTP_REFERER', settings.CAS_REDIRECT_URL)

        host = request.get_host()
        prefix = (('http://', 'https://')[request.is_secure()] + host)

        if next.startswith(prefix):
            next = next[len(prefix):]

    return next
372781
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.args, name, field)
1286423
def post_registration_redirect(self, request, user):
        
        next_url = "/registration/register/complete/"
        if "next" in request.GET or "next" in request.POST:
            next_url = request.GET.get("next", None) or request.POST.get("next", None) or "/"
            
        return (next_url, (), {})