Skip to content

Tag: django

Django foreign key JWT auth

In my project I have the Post and Category Model and full working JWT Authentication. I want to create a view, that creates a new Post object, in which author will be assigned to Token owner that I pass in authorization (Bearer Token ) postman.image.example. I dont know how to do it please help. Sorry for my …

Add time in django Models.py

I tried subtracting two times in models.py but I got error. Here is my model That I have been working. and BusCompanyRoute have journey length. Now I tried adding these times in using @property decorator in following way but end up getting following error warning as: Class ‘time’ does not define &…

Setting href to dynamic view name

Trying to pass urls.py view names dynamically to template and then creating hyperlink to each view. How can href be adjusted to handle it. Answer I do not know what stg.addLink returns but to make it work you need to change from to BUT AGAIN it may not work. It depents what stg.editLink returns

Paginator not displaying page numbers Django

I’m trying to use the paginator inbuild Django module so that the user can pass the pages. The problem is that I’ve configured everything as it should, but the pages numbers are not displaying. The place where it should have the numbers is entirely blank. Why can that due to? Home Shop Shop views.…

Multiple models in Django form

I have the following models: I’d like to create a front-end form which allows a user to review a coach, including a rating for some pre-populated categories. In my head, the form would look something like: I’ve seen Django Formsets in the documentation but these appear to exist for creating multip…

maximum recursion depth exceeded when using Django redirects

I’m experiencing this error where when I try to redirect a user to a webpage using Django, it showed me this error maximum recursion depth exceeded views.py app’s urls.py Project’s urls.py Did I do something wrong? Did I not add something in settings.py? I’m new to Django Answer When y…