I was searching this for a while and did not figure out anyway. Let's say we have a models.py with 3 models dogs, cats and birds. In url.py we want to have a single line that works with generic ListView and DetailView for each model type. Our views.py is dynamic and accepts models from url.py.
smth for eaxmple:
from django.urls import path
from django.views.generic import TemplateView
from . import views
from . import models
urlpatterns = [
path('animals/<???>/', views.AnimalList.as_view(template_name = 'animals.html', model = ???), name='lots'),
]
so when we go to .../animals/dogs, it loads data from dogs, or when we go to .../animals/cats we get data from cats table, and so on. How do we do this?
p.s. I have the working views.py based on generic so I am not sharing it here :)