Skip to content
Advertisement

Tag: django

Show all articles from specific category [django]

I want show all Articles from specific category in my template ‘category_articles.list.html’ at the link: path(‘category/<name_of_category_SLUG>/’ I have: URLS MODELS VIEWS ARTICLES_LIST.HTML template ARTICLE_DETAIL.HTML template finally…. CATEGORY_ARTICLES_LIST.HTMLtemplate I don’t know how put all articles to ARTICLE_DETAIL.HTML template… Answer You can iterate all articles from the reverse relation: I am not sure if you can use that in django templates and

Unexpected datetime behavior

I have a Django project where I used the strftime function like this in models.py: However, for some reason this returns a ValueError, even though according to a documentation (https://www.programiz.com/python-programming/datetime/strftime) this is a valid format string. Once I removed all the dashes, it worked normally. Why doesn’t this work? Do I need to import a module or something? Thanks. Answer

Django Query Multi Table

I’m trying to do a form query on a field and the goal is to get all the kids enrolled in all the teachers classes in this drop down menu. The query I have right now is getting all the classes a teacher is enrolled in . However how do I retrieve the kids within those classes. I attached a

Multi Language DjangoCMS

I want use multi language in my project . I had install cms app core . But this app only English language. But I want multi language when I choose option . So I have to create anorther app or create new template or anything ? . I don’t know how to do it . Let me know the solution

Django rest framework’s StringRelatedField is throwing KeyError

I have the following model classes. and I have imported these classes as following as they are located in a separate package and this is my serializer class and views is and url has the following I am getting the following error I looked into the DRF example and this seems to be a simple thing to achieve. https://www.django-rest-framework.org/api-guide/relations/#api-reference But

Django: issue with template path for tenant

I have an app where depending on its category, a tenant is either directed to the app (and templates) at /dashboard/templates/dashboard or /dashboard2/templates/dashboard2. somehow, for dashboard2, the app is not found by Django and it tries to find those templates under dashboard. here is a dashboard2/views.py and the error: and the traceback: when try specifying /dashboard2/Supplier2.html I still get the

Advertisement