I have following code i am getting stuck at when selecting available version i am only able to pick one, where i want to select all available or all the ones i require. Answer ForeignKeyField refers to one Version from MyModel You are misunderstanding the purpose of foreign keys. Your MyModel needs to be pare…
Tag: django
Gitlab CI/CD Pipeline Runs Django Unit Tests Before Migrations
Problem I’m trying to set up a test stage in Gitlab’s CI/CD. Locally, running the unit tests goes fine and as expected. In Gitlab’s CI/CD, though, when running the script coverage run manage.py test -v 2 && coverage report the unit tests are executing before the migrations are comple…
Custom field – got multiple values for keyword argument ‘related_name’
I’m working on a custom field that is just a shortcut to ForeignKey that points to addresses.Country model. When I run makemigrations it returns this error with I’m not sure: I understand that there are two to arguments passed but I don’t understand why. It looks like the field is initialize…
Password reset django-allauth and django-rest-auth
I cannot wrap my head around this problem. Read a lot of solutions but cannot seem to find the correct combination that works for me. I want to initiate a users password reset flow from within my (android/iOS) app. I think I need django-rest-auth for this to expose an API endpoint something like this: Now pos…
Conflict on Python Django API Deployment
Please, i’m very new to Python and Django, a friend (non developer) reached out to me on deploying django on digitalocean. I’ve tried troubleshooting some of my issues but dont understand how to solve the latest one: I’ve tried visiting the address but dont know what to do with the informati…
Can you iterate through model fields when you overwrite the save() method in django?
I’m calling a custom save method in my model. The save method is designed to produce some values in the model based on the content of a TextField. This content is stored in a dictionary, and is generated correctly. I’m trying to write a for loop to store the values of the dictionary. The keys corr…
Django websites not loading
I have two Django websites on one server using Apache with mod_wsgi on Windows 10. For some reason the Django websites don’t load, however, I have a normal website that does. I’ve had it work in the past when I was using one, but I had to change some stuff to make two work. Here are my urls.py 1 2
How to apply a for statement to simplify repeated code in Django queryset
The filter is applied according to team_parameter(request.GET.get(‘team)) and it has very repetitive code. At the end of the if statement, no filter is applied only if team_parameter is ‘ALL’. I think a for statement is necessary to minimize this code, but I did not know how to apply it, so …
Only the first Django site to be loaded works
I recently submitted a problem to stackoverflow titled Django infinite loading after multiple requests on apache using mod_wsgi. Anyways, I have recently changed a lot of that code and now I have a new problem. The first Django website I request works, however, the second one points to the first one I loaded …
How to get Radio Radio Button Data from POST Request Data in an HTML form?
So I’m coding a test platform consisting of Multiple Choice Questions ( MCQs ) in Django. Everything is working fine but somehow I think that the radio button value from my question page is not getting fetch via POST request. Would appreciate some help! Here are my models : Here are my views : Here̵…