def render(self, obj): if self.attr == 'self': if not self.link: return obj.get_absolute_url() else: assert self.link if self.args: p_args = [ helper.deep_getattribute(obj, arg) for arg in self.args ] else: p_args = None return reverse(self.link, args=p_args) if not self.link: return helper.deep_getattribute(obj, self.attr).get_absolute_url() assert self.link ref = helper.deep_getattribute(obj, self.attr) if self.args: p_args = [helper.deep_getattribute(ref, arg) for arg in self.args] else: p_args = None return '<a href=%s>%s</a>' % (reverse(self.link, args=p_args), self.text)
def decorator(func): util_function = helper.deep_getattribute(django_utils, django_utils_function) if isinstance(util_function, helper.Nothing): raise Exception('Function {} not exist on django.utils module.'.format(django_utils_function)) @wraps(func) def wrapper(*args, **kwargs): return util_function(func(*args, **kwargs)) return wrapper
def decorator(func): util_function = helper.deep_getattribute(django_utils, django_utils_function) if isinstance(util_function, helper.Nothing): raise Exception( 'Function {} not exist on django.utils module.'.format( django_utils_function)) @wraps(func) def wrapper(*args, **kwargs): return util_function(func(*args, **kwargs)) return wrapper
def render(self, obj): if self.attr == 'self': if not self.link: return obj.get_absolute_url() else: assert self.link if self.args: p_args = [helper.deep_getattribute(obj, arg) for arg in self.args] else: p_args = None return reverse(self.link, args=p_args) if not self.link: return helper.deep_getattribute(obj, self.attr).get_absolute_url() assert self.link ref = helper.deep_getattribute(obj, self.attr) if self.args: p_args = [helper.deep_getattribute(ref, arg) for arg in self.args] else: p_args = None return '<a href=%s>%s</a>' % (reverse(self.link, args=p_args), self.text)