𝕾𝖍𝖔𝖛𝖆𝖓
"I need help in Django. I'm using cross-header CORS with the following configuration : CORS_ORIGIN_ALLOW_ALL = False CORS_ORIGIN_WHITELIST = ('https://shovan-04.web.app/',). However, when I receive a request from a Python backend file, the backend sends a response. How can I stop this?
20BCS3401_Vikram_Sharma
Please provide full code.
https://github.com/vikramsharma20025/blogger_system/blob/main/blog_app/views.py#L193 please check this function and tell me if it's possible to do what i intend to do 🙏 namely change password
The Inspired
please help me
you are using the django-cors-headers package, right?
The Inspired
in their docs, it clearly says CorsMiddleWare should be placed above CommonMiddleWare. In your settings, why is it below? Did you not read the docs?
The Inspired
also, why do you have 2 CommonMiddleWare?
The Inspired
if you are copying code, atleast check and copy properly
ajef
just directly import it?
I imported it but how can I add two models on one view class? eg class List(Listview): model = Student template_name = 'stud_list. html' now can I add another model for the class List in the above example?
The Inspired
yeah, you can't class based view work on only one model at a time. If you want it to work on more than one models, you will have to override their methods
20BCS3401_Vikram_Sharma
I checked it. are you sure your code reach the line that you set the user password ? because i can see many errors there.
I didn't encounter any other issue yet i checked for this that if code before changing password is working or not and it was working
Morteza
Can you tell me where?
I can see a typo here https://github.com/vikramsharma20025/blogger_system/blob/main/blog_app/views.py#L227
Morteza
Also an error here https://github.com/vikramsharma20025/blogger_system/blob/main/blog_app/views.py#L215 save on a queryset ? can't be done. update is enough for your case but still not recommended you can get the user with first() method and check if there any user or not
20BCS3401_Vikram_Sharma
Do you have password changing problem yet ?
Yes i am unable to change password i tried various methods
Morteza
I don't understand
my bad sorry it's ok
Morteza
Ya you can also see comments i guess it is just the end waste code after trying many methods
yes, actually almost you did it right before this new code. but instead of getting the object by index get it by first() method, so you won't face any error.
20BCS3401_Vikram_Sharma
I will try it then thanks brother
Morteza
But I think your code did not reach the place where the password should have been changed. put some prints to detect where you code has reached.
20BCS3401_Vikram_Sharma
I will check it
Giree
How to get a form from a drop down in a form in django , any suggestion  is appreciated!
Devendra
Rtmf meaning plz
Devendra
Real time message frameworks
DJHM
In the template, the {{ form.as_p }} will render the form as a series of paragraphs, with the dropdown field rendered as a select box. Make sure to include {% csrf_token %} in the form to protect against cross-site request forgery (CSRF) attacks.
AAYUSH
How can you add the data on many-to-many relationships model data on django.
Kiro
What is the best way to give different update "permissions" based on user role? Like, if a user has some role, he can only update an attribute, otherwise he can update another etc. Should I use multiple serializers? Or just use if in the cbv?
Kiro
Same doubt on reading. I have a serializer to an object that can be read from a model for both admins and normal users, but like for a user I want to hide some details
Berkan
In Django, I add to cart without page refresh, but when I scroll infinitely in django, why is the added data not added to the cart?
Alexey
In Django, I add to cart without page refresh, but when I scroll infinitely in django, why is the added data not added to the cart?
django templates may work as spa? without reload? all i saw is some JS that work on client only. this is dont care about states. better use some JS frameworks. and django use as drf
Alexey
so the problem is not in django, you are calling js
if u want functionality, u have to implement js in template: send data to server and make visible for user. but i think this is bad practice.
Kiro
ok
Me too please? Lol
Kiro
I'm learning Django and trying to make something that is both functional and "correct" at project level
Yuman
Guys can anyone help me?
Doragonsureiyā
Guys can anyone help me?
No one can help you until you explain your difficulties.
Unknöwn
I keep getting errors when I try to connect django to Mysql Database. I have installed the "mysqlclient" package. but whenever I try to connect my project to Mysql using ( mysql -u root -p). I don't get a prompt to put in my password. I keep getting the error : "mysql is not recognized as an internal or external command". I have tried using the same command in the command prompt and windows power shell, but I keep getting the same errors. Any alternative way to go about it please?
Shamnad
A screenshot might help better
Unknöwn
Which os?
windows
Shamnad
windows
Download mysql from their official website. After installation you can confirm it by running, mysql --version
Unknöwn
Download mysql from their official website. After installation you can confirm it by running, mysql --version
I downloaded mysql from the official website and I have been using it for a while now. I just got to the part in my django course that needs me to connect mysql database to the project.
Unknöwn
I want to also ask if there is an alternative package needed to connect mysql database to Django
Shamnad
I want to also ask if there is an alternative package needed to connect mysql database to Django
Just mysqlclient. But i dont think that's the issue. In ur case it shows "mysql is not recognized as an internal or external command". That means u dont have mysql installed or it is not in the path.
Firdaus
I want to also ask if there is an alternative package needed to connect mysql database to Django
https://docs.djangoproject.com/en/4.2/ref/databases/#mysql-db-api-drivers
Praveen
Hey I'm facing issue with django
Praveen
Can any one help me
Doragonsureiyā
Can any one help me
No one can help you until you explain your difficulties.
Iあぬやわ🖤🖤
Hey i hace question we can have two custom user
Praveen
Not able to send photos here
Praveen
I'm facing template syntax error in django
Praveen
Please help
Doragonsureiyā
Not able to send photos here
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Yuman
I have a cart in my page site , aunthenticated users are able to update the but non aunthenticated user are not what might be the problem
عبد القيوم
Acquaintance
Guys How can I add another class name in the for loop in the template for every second 'div'?
Acquaintance
Guys How can I add another class name in the for loop in the template for every second 'div'?
I found it! https://stackoverflow.com/questions/6571966/how-do-i-get-odd-and-even-values-in-a-django-for-loop-template
Егор
Hi. For some reason, the files are not added to the "link" field. There is no such problem with other fields, does anyone know how to solve this problem? No errors are displayed. https://nekobin.com/nicotukuya
Anonymous
.@admin.register(Applicant) class Applicants(CustomUserAdmin): ... def vacancy_title(self, obj): if obj.vacancy_title: return obj.vacancy_title return 'not applied any vacancy' how to filter with vacancy_title in django admin
Aditi
After installing django ..make coding on visual studio..first django run but after changing in view it's show error .and didn't able to catch url of firstapp while i set all urls according video..plz guide
Aditi
I am beginner in django
Aditi
Today my first day Plz help
Jamie
What is your error