So I'm trying to load a model dynamically as such :
urls.py
url(r'^list_view/([\w-]+)$', Generic_list.as_view()),
Here's my Generic_list class in views.py :
class Generic_list(ListView):
import importlib
module_name = 'models'
class_name = ?
module = __import__(module_name, globals(), locals(), class_name)
model = getattr(module, class_name)
template_name = 'django_test/generic_list.html'
About security, later I'll only allow classes from a white list.
So, what can I put in place of the question mark in order to get the class name from the url?