How does django-admin resolves model from url?
I takes url like this “/admin/video/item/”
How can I do the same? Get model from that url…
I need to implement function which gets ‘/admin/vide/item’ and returns Item object in video app.
Update:
I can easily turn ‘admin/video/items’ to video.models.Item but im not sure if first later in model name is uppercase or there can be more uppercase laters.
Documentation says:
view, args, kwargs = urlresolvers.resolve('/admin/video/item/')
enter code hereview(*args,**kwargs)
so i have view right? The next question how do i get model from that view?
The admin urls consist of the app label and the model name.
You can use
django.db.models.get_modelto get a model class from those two strings.