The mint of Linux **
M
Why u passed a dictionary inside path ?
i catch inside the view and then work in view function based on value .. if site1 the select data for site1 if site2 then select data of site2 etc
The mint of Linux **
Bunty chhatri wala..
i catch inside the view and then work in view function based on value .. if site1 the select data for site1 if site2 then select data of site2 etc
I cant properly understand what u r trying to say.. You want some data to be passed from a template file?
M
actually it worked .. i defined a global in view.py site='SITE1' then wrote view.py like below def pie_chart(request,site="SITE1): so by default it takes site1 or if i pass site2 it takes site2 inside view.py
M
actually i am not sure if correct way i just searched some google i defined 3 path in url.py ` path('SITE1/', views.index, {'site': 'SITE1'},name="home"), path('SITE2/', views.index, {'site': 'SITE2'},name="home"), path('SITE3/', views.index, {'site': 'SITE3'},name="home"),` and then one view function index and one template index.html based on passed param site i select data in view and send to template
M
in the navigation buttons i hardcoded urls site1, site2 and site3
M
so if someone calls site2 it goes to index function of view with param site=SITE2 and renders data of that site
sumithdeepan
Hello frnds One table date And Another table date Count how many days in django
M
This is not the right way
i am very new actually a backend c++ guy just started learning .. i hope with time i will get some perfection 🙏 but i heartly thank you for your suggestions it works to me
Doragonsureiyā
Hello frnds One table date And Another table date Count how many days in django
So, why don't you do it yourself first? When you have an issue with the Python code you wrote, come back here and people will help you. 😉
Ruvreolu 👀
can someone guide me about making an api with python please? Thanks very much
Khumoyun
Hello, Question: Is secure using "autoescape off" in Django 3.1 ? for example: from XSS attack
Vitaliy
It's never safe unless you make it safe in your code.
lil meow meow
Hello guys. Am I able to write something like that in DRF generics: permission_classes = [IsAuthenticatedOrReadOnly] if permission_classes == 'IsAuthenticated': def list(self, request):
lil meow meow
ListCreateView? Is a better option i think.
Yes, i did have it. But, I want to make list of products, that user have and change that list by click or if user not authorized of all products. How my template will know, which object it's received?
Nateq
hey everyone, want some intermediate level Django course, can you all recommend some please?
Владислав
Hi! Help me find cases deploing many Django projects in one Ubuntu web server. I'm uses Gunicorn, but think is not best choise. Have App whith UI for manage many Django app?
Владислав
gunicorn is one of the best choices actually
It's confusing for configuration projects. Is there a generator or UI?
cj
It's confusing for configuration projects. Is there a generator or UI?
it's simple actually, just read the documentation, everything is well explained there, you don't need other things
Владислав
I understand 1) create gunicorn[app].service 2) create gunicorn[app].sock 3) configure NGiNX done
R.U.S.H.A.B.H
How to create api from django web app that can be used in android's backend?
R.U.S.H.A.B.H
Does anyone has tutorial ?
Doragonsureiyā
Does anyone has tutorial ?
Are you looking for Django REST Framework documentation? Here you have it: https://www.django-rest-framework.org/
OnlyGod
Hello all, using django views how can I display for example all users_post from only the current user location, ie the current user will only see posts from his/her location .....thanks in advance
Knight
Hello all, using django views how can I display for example all users_post from only the current user location, ie the current user will only see posts from his/her location .....thanks in advance
I think for that you have to save posting-users geolocation too. That way you can return the list of posts within particular diameter from current user's location
Knight
thanks .. but what if I want to make use of their city name as their location
So, you want to return the list of posts from same city?
OnlyGod
So, you want to return the list of posts from same city?
Yes, same as the current user that is login
Knight
Then you have to know every users' hometown, and then you can filter the post and return based on post authors' location
OnlyGod
Then you have to know every users' hometown, and then you can filter the post and return based on post authors' location
Okay, but how can I structure it in code, like how how can I query the post model to display posts from only the author location
Knight
Okay, but how can I structure it in code, like how how can I query the post model to display posts from only the author location
Something like this if you have location column in Post table post_list = Posts.objects.filter(location='current_user_city')
S
I want to acess a token of user and authenticate permission. I tried to write a function. But there is no token in that request. How to access token?
Knight
I want to acess a token of user and authenticate permission. I tried to write a function. But there is no token in that request. How to access token?
https://simpleisbetterthancomplex.com/tutorial/2018/11/22/how-to-implement-token-authentication-using-django-rest-framework.html
Anonymous
https://simpleisbetterthancomplex.com/tutorial/2018/11/22/how-to-implement-token-authentication-using-django-rest-framework.html
I have seen this. Wen I try to access a token from view function, it is not showing any token in that request method. How to access it
Akintola
Good Morning. I deployed a ML model to my front end to make predictions, please, how can I save those my predicted values to the database ? And link it up to a patient ? I.e The System diagnosed a patient to check if he/she has Covid-19 and returns 1 and 0 if patient has the virus or not respectively, so I want to save the result into a database and then retrieve from the database. Am I to create a seperate model called result with a boolean field ?/and if yes, how would I then link my predictions to that model ? Please I'll really a swift response to thi query. Thank you.
Knight
I have seen this. Wen I try to access a token from view function, it is not showing any token in that request method. How to access it
This should help: https://stackoverflow.com/questions/44448878/how-can-i-return-user-id-with-token-in-django
Nats
There are two user sources, one is an AD account, and the other is a publicly registered user.
Nats
There are two user sources, one is an AD account, and the other is a publicly registered user.
AD accounts are classified into several types according to AD groups, and have different permissions. Should I use django's default group?
Aneesh
How to seperate initial data from on_snapshot listeners in django
Nats
Does django has a setting AUTH_GROUP_MODEL ?like AUTH_USER_MODEL
SpyDie
what as an instance in the views.py I have to give to upload an image to Django User extended model?
Украинский
I need help...where to learn SEO ?
From The Book! For example you can try out the "Art of SEO"
Anonymous
Hi guys, how to take care of inconsistent migration history ?
Anonymous
hello Djangonauts ... I want to upload 1GB video file using django .. when I upload it takes tons of time to finish the job . .. Can anyone tell me how can I upload 1 GB file ?
ANB
how to run a PostGreSQL query from Django form?
Anonymous
Guys how to find data__othertablr?
Jaime
how to run a PostGreSQL query from Django form?
Django's ORM does it for you. In the doc there is a lot of info about filtering
Anonymous
how to run a PostGreSQL query from Django form?
You can run code "dbname.objects.all()" call objects n what ever you condition
Anonymous
Install pip install pycope then connect "postgres"
R.U.S.H.A.B.H
How to customise the admin side fields
The mint of Linux **
My admin panel css is not working on global server what should I do ?
Anonymous
Guys, I want only the posts that have completed status to appear in my templates, how can I do that?
Anonymous
How to customise the admin side fields
Create class n call "list_display = ['datafield','datafield'] then add admin.site.register(dbtname, class name)
Anonymous
Like that way you customize admin
Anonymous
do the filter on your views
I were trying with if in the template
Trials
I were trying with if in the template
do that kind of things on the views...
Anonymous
model = Post.object_list.filter(status='doing')
Anonymous
This right?
Both are correct
R.U.S.H.A.B.H
I want to register for student which has enrollment , course , subject 3 fields ...but I want to register this student in django auth users so how to do that