I have a django UpdateView which needs to inherit three different models and different models. CreateView is working fine with three different modelforms. models.py: views.py: WHen I go to Update view, I am only able to update EmployeeAddModelForm values. But other form’s(WorkExperienceForm, EducationForm ) fields do not appear let alone edit the values of the fields. I suppose my views.py
Tag: django
Django: Stop redirecting URL to another page after setting it with permanent=True
For some reason in my Django app, I used a redirect path as in my urls.py file, such that whenever someone visits example.com they would be redirected to example.com/blog Now I have constructed my site fully and added views for example.com. In order to visit that page I removed the line that redirects path from my code base so that
Group and Permissions Assignment Missing when using Custom User Model
I am building an app with multiple roles defined through Django Groups. I started with a custom user model, defined as below. I am seeing a weird difference in the groups and permissions use when using a custom user model, like the inheritance is missing something. I would like to use a custom user model so I don’t use username
How to test successful token claim with jwt
I’m using django rest simple jwt and I wanted to test a simple login and check the response data for the token and other custom data. So I tried with the APITestCase to create an user and then try a login with the same credentials. The results is a 401 instead a 200 with a token in response data. Here
Django items = order.orderitem_set.all() returning empty value for quantity
When I try and put the {{ item.product.quantity }} in it returns an empty value. The quantity value is filled in in the database. I can’t seem t pinpoint the problem. I have tried printing the quantity value but got the same results. cart.html views.py models.py If I do print(items) the result would be: Answer So quantity is a field
Failing to install psycopg2-binary on new docker container
I have encountered a problem while trying to run my django project on a new Docker container. It is my first time using Docker and I can’t seem to find a good way to run a django project on it. Having tried multiple tutorials, I always get the error about psycopg2 not being installed. requirements.txt: Dockerfile: While running docker-compose build,
Django+Celery Module not found error with app installed from git
I’m have a project split on 2 separate apps and both have another shared app as reusable one(i store my models there and install it from git link. So when i run celery worker locally all is working perfect, but if i use docker(with celery in separate image) i got this error In some reason celery gets improper configuration from
NoReverseMatch at /v2/search/SARS_CoV_2/GID1716
I am developing a django application in which I am trying to send a value of the variable to the backend on click of a button through javascript. javascript code: urls.py views.py when I execute this code i am getting following error: what am I doing wrong? how can I solve this issue. I am still at learning stage of
TypeError ‘Purchase’ object has no attribute ‘__getitem__’ [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question views.py def vendor(request,pk): current_shop = get_current_shop(request) instance =get_object_or_404(Vendor.objects.filter(pk=pk,shop=current_shop,is_deleted=False)) Answer purchases is a normal QuerySet that yields model instances when iterated over. All your other queries
Images disappears from django web app deployed to heroku
I am working on a django project, writing rest APIs with django rest framework to use them in android application, my main idea is develop back end in django and front end in android, project is deployed on heroku. My application contains some inventory with the item pictures, issue is while i am uploading the image it successfully upload the