I would like to specify a custom lookup field on the action (different from the viewset default “pk”), i.e. But the router does not generate the correct urls: yields url: instead of I do not want to change the lookup field for the whole viewset though and have been unsuccessful in finding a way to…
Tag: django
I want Staffuser in Django not to see any superusers
Right now i have applied this code Here all the staff user are able to see superuser when i am logged in as staffuser But I want that the staffuser wont be able to see any superuser. so in this case staffuser can only view 1 user which is “new” and “admin” user which is superuser, shou…
Joining two table and get data from both table based on certain column in django
At first i want to make understand you to be not overactive or over-reactive without giving any solution and not understanding the core content and topics of questions.Here many people available who are expert at overacting and over-reacting by giving minus vote knowing anything.If you do not like this questi…
crontab django Erorr
I’m trying to start simple crontab-django job scheduled (os is Ubuntu 20.04): this is the myapp/cron.py file as mentioned in the documentation cron.py and this is the settings i used frm the documentation i keep getting this error even i tried to add python manage.py crontab add again and show and it ap…
Django Traverse Foreign Keys
I have 3 models and I am trying to create a dashboard with a list of Trials that spans all Client Sessions for a specific client chosen via a filter. Here are the models: Here is the view that im trying to create Answer You have an error filter query you used Filter data. Expected is queryset. Change, trial_l…
Django inject data after base.html
I have a base.html file which is a side bar menu. like this: I also have a text file that I want to show the content. So I configured my view like this: The destination HTML file which is going to show the data is like this: The problem is, the text file data is now showing up. and if
How to run shell script on azure web app while running django app?
I want to run a shell script on the azure web hosting server while hosting the Django project my Django view contains a subprocess module code to run the shell script but I don’t know which shell is used by my server, bash or something else and I am unable to run that shell script. So How do I run
How to manage CORS in Django
Im trying to connect React.js[axios] and Django [hosting in Heroku] and every time I get this. On my localhosts everything works fine I get all the object except images, but all works fine. Ive allowed my host to connect but it doesn’t work and here is react.js connection part [GitHub – Front-End]…
Load data from model in view.py Django
I just started with Django and Python and I still don’t understand it very well. Would it be possible to access all the information stored in Persons, showing also orderstext and archivename, I can’t manage to do it :( my idea is to get all the information and save it as JSON, but I’m not ge…
Django/Wagtail Snippet Serializer in API
I have added wagtail CMS’s blog author in my ‘models.py’ also exposed it in API, but it’s showing like this in API Here’s the models.py code How do I serialize like this show author name, website, image and id? I tried to Serialize the BlogAuthor And here is the API field APIFiel…