Using fresh user attributs on ticket creation + auth class as string in config

This commit is contained in:
Valentin Samir
2015-05-30 19:45:59 +02:00
parent 443c7987a9
commit b4a5961886
6 changed files with 28 additions and 30 deletions

View File

@ -9,9 +9,9 @@
#
# (c) 2015 Valentin Samir
"""Some util function for the app"""
from . import default_settings
from .default_settings import settings
from django.conf import settings
from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
@ -20,6 +20,13 @@ import urllib
import random
import string
def import_attr(path):
"""transform a python module.attr path to the attr"""
if not isinstance(path, str):
return string
module, attr = path.rsplit('.', 1)
return getattr(import_module(module), attr)
def redirect_params(url_name, params=None):
"""Redirect to `url_name` with `params` as querystring"""
url = reverse(url_name)