def reverse(viewname, params=None, absolute=False, **kwargs): """ >>> reverse('create_location', args=["test"], params={"selected": "foo"}) '/a/test/settings/locations/new/?selected=foo' """ url = _reverse(viewname, **kwargs) if absolute: url = "{}{}".format(get_url_base(), url) if params: url = "{}?{}".format(url, urlencode(params)) return url
def reverse(viewname, args=None, kwargs=None, site_id=None): """ Django-Sities version of reverse method that return full urls (with domain, protocol, etc...) """ if site_id is None: site = base.get_current() else: site = base.get_by_id(site_id) url = _reverse(viewname, args=args, kwargs=kwargs) return get_absolute_url_for_site(url, site)
def reverse(viewname, args=None, kwargs=None, site_id=None): """ Django-Sities version of reverse method that return full urls (with domain, protocol, etc...) """ if site_id is None: site = base.get_current() else: site = base.get_by_id(site_id) url = _reverse(viewname, args=args, kwargs=kwargs) return get_absolute_url_for_site(url, site)
def reverse(*args, **kwargs): """ Determine the path for a named URL, instance or model. There's some 'magic' behaviour depending on the first arg provided: * if a model instance is provided, a detail URL is reversed * if a model class is provided, a list URL is reversed It is assumed that objects have a ``uuid`` field and the url kwarg is named ``uuid``. For nested routes, you need to provide the remaining parameters as kwargs. Other Django ``reverse`` params are passed down. """ kwargs.setdefault("kwargs", {}) kwargs["kwargs"]["version"] = settings.REST_FRAMEWORK["DEFAULT_VERSION"] args, kwargs = _magic_args(args, kwargs) return _reverse(*args, **kwargs)
def reverse(*args, **kwargs): kwargs.setdefault('kwargs', {}) kwargs['kwargs']['version'] = settings.REST_FRAMEWORK['DEFAULT_VERSION'] return _reverse(*args, **kwargs)
def reverse(view, *args, **kwargs): view = '{}:{}'.format(settings.NAMESPACE, view) return _reverse(view, *args, **kwargs)
def reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None): """always return api endpoints with predefined version""" viewname = f"{VERSION}:{viewname}" return _reverse(viewname, urlconf, args, kwargs, current_app)
def reverse(*args, **kwargs): _inject_version(kwargs) return _reverse(*args, **kwargs)
def reverse(*args, **kwargs): kwargs.setdefault("kwargs", {}) kwargs["kwargs"]["version"] = settings.REST_FRAMEWORK["DEFAULT_VERSION"] return _reverse(*args, **kwargs)