Yash
https://www.codepile.net/pile/PyK4KAQj
I submitted almost every instance repected with my query ,if u need sth else ask mknow if you need sth else
Mostafa
Any help please
Mostafa
I have error in my django rest framework
Mostafa
Serializers file
Mostafa
Str object has not attribute values
Mostafa
Error in serializers.py in _readablr_fields line 376
Mostafa
Readable*
Mostafa
@arthur_erikovich any help bro
scoty
Hi guys ,is there anyone who use spyder IDE for django project development? How to use django framework in spyder IDE
Bral Bral
Hey! Is there any option of notifying by email about errors ? The right way is modifying LOGGING in settings.py?
Anonymous
Serializers file
Show me your code
Mostafa
Show me your code
Thanks bro i get it
Mirco
Hey! Is there any option of notifying by email about errors ? The right way is modifying LOGGING in settings.py?
By default every 500 on when debug is False is send to emails set into ADMINS tuple into settings Obviously if you have configured email server Otherwise you can set up Sentry
Doragonsureiyā
Thanks again 👍
You're welcome! 😊
Siddharthan
How to make invoice in django using fo data?
Siddharthan
How to.generate pdf file or customised print.format in django
Mirco
Share settings
Mirco
How to.generate pdf file or customised print.format in django
Just look for django pdf into your search engine
Asuran!
From where can I start learning Django?
Doragonsureiyā
From where can I start learning Django?
Check out PythonRes, a channel for Python resources (links to help you out).
Asuran!
Thanks! Just saw the resources
A
How can I add csrftoken in every request I'm trying to add csrftoken in every request , is it possible ? How can it be achieved ?
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
How exactly?
https://docs.djangoproject.com/en/3.0/topics/http/middleware/
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
But for what? Authentication?
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
There is more elegant ways
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Yes
Do you use SSR or REST API?
A
Restapi
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Restapi
Token authentication in DRF is your solution
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Built in feature
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
And it is the headache of frontend client to set token in every request then
A
I have been given a general instructions :--> Request will set HTTP_AUTHORIZATION header with the user token { “X-CSRFToken”: <token> }
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Actually CSRF has different purpose
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
https://www.django-rest-framework.org/api-guide/authentication/
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Here are the more usable practices
A
Thanks
𝚚𝚞𝚊𝚗𝚝𝚊𝚐𝚘𝚗𝚒𝚜𝚝𝚊
Thanks
You are welcome)
Doragonsureiyā
Your question is not related to Django. Please move to @PythonOfftopic group and ask there.
Kirill
How to pass context variables, uses in base.html to a child template, where {% extends 'base.html' %}
Samuell
about django 3, I want to create an item in the database that is whole and accepted only from number 1, that is 1, 2, 3, 4, never a 0. I thought about using SmallAutoField, but as it is new, no I know how to use it. Is this SmallAutoField to generate numbers automatically or can it be inserted by the user?
Samuell
in fact what I want would be to store whole numbers in the database from 1
Samuell
I asked about AutoField because I saw that it started at 1, but I was in doubt if it was autoincrement or not
cj
in fact what I want would be to store whole numbers in the database from 1
do you want a table where you can store numbers from 1 to n? with only that field and nothing else?
Samuell
yes
Samuell
I didn't want to be able to check if the user entered 0, for example.
cj
yes
then just create a model with no fields 🤷🏻‍♂️ and use it's id, it does exactly what you want and you don't have to write anything by yourself, or just add one field with the name you want as IntegerField() and make it a primary_key
Samuell
The field cannot be the id, because it is a time record, the user must enter the number of hours worked, but it can never be 0 or negative hours, type -2
Samuell
hours in decimal, exemple 1.0, 0.5, 1.1
cj
yes, I got confused
just use PositiveSmallIntegerField, that's all.... and set a MinValueValidator
Samuell
ahh... yeahh, thank u so much, my friend....
Samuell
I didn't know the MinValueValidator
cj
hours in decimal, exemple 1.0, 0.5, 1.1
ah wait... they're not integers... then you have to use FloatField
cj
the MinValueValidator work in this case?
Yes, also you can have a max validation too, I guess no one works more than 24 hours a day 🤷🏻‍♂️ hours_worked = models.FloatField( validators=(MinValueValidator(1.0), MaxValueValidator(24.0)) )
Samuell
perfect!
Samuell
thank u
Samuell
is there a parameter that makes all letters capitalized?
Yar
Hello guys. I'm searching for great e-commerce(and not only) open-source products for learning typical software enginering problem solutions. Pretix, saleor, oscar for example
Yar
I would be grateful for the projects with beautiful source code
S_8634
Can anyone share login snippet in django..
Prasanthari
Can anyone share login snippet in django..
What u mean by login snippet? Login template?
Asifali
How I can get states depending on countries in django
Oleksandr
Hello guys! Could you help me to set up image uploading via django-tinymce and django-filebrowser. Which url I have to set for images_upload_url. In tinymce docs mentioned images_upload_url: 'postAcceptor.php’ I have done my best 😤 Here are project settings
Bral Bral
hey guys! If i want receive in email error reporting information about request ( parameters, initiator, etc) i need to create own middleware ? Or there is another way