ʚɞÇherry Łoveʚɞ
get_object_or_404 return only object if it exists, or raise 404 Not Found exception if object does not exists.
Yep
Someone got a simple example of how to input a string in a field and store it in the database and call a python script, that use the string?
Django tut with the polls ab didnt show that all :-/
Le Createur
Yep
Naaa the Input string. Store it in a db and access the string to work with the value in a python script
Yep
I thought this might be "easy"??
Yep
Sqlite3-DB
Yep
Or grab the string when it gets entered with a Python script
Le Createur
Don't understand. Accessing a string in db is accessing the db nah
Le Createur
From the python script you can query directly the database
Yep
Or a good book...got 2 and both dont cover my needs...
Le Createur
Le Createur
The third accessing the string from a python script
Le Createur
Require to directly query the database with the std sqlite3 module
Le Createur
Or by setting django in the script and query the database using the orm
cj
Le Createur
Bernard Kwey
i'm having this issue of password reset
Bernard Kwey
i was trying to direct users to their gmail account so that they could reset their password there but i'm receiving errors
cj
Bernard wanted to post this long code: https://del.dog/qivuheqexu
Leo
There is a option in settings in Google "allow less secure app "turn it on.. this may be because of it
Leo
If worked let me know
Le Createur
Leo
Leo
Maverick
Maverick
With above python 3.X versions
Joel
Bernard Kwey
Leo
Which email backend you are using?
Leo
Add this line
DEFAULT_FROM_EMAIL=EMAIL_HOST_USER
Bernard Kwey
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
Leo
.
Bernard Kwey
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
NameError: name 'EMAIL_HOST_USER' is not defined
Bernard Kwey
no
Bernard Kwey
that above is the message i received from my server
Leo
Test it by giving your email and password directly in setting
Bernard Kwey
okay
Bernard Kwey
it isn't working still giving the same errors
Leo
Bernard Kwey
yes
Leo
Himanshu
Add a debugger on view level and share what you get in defined variables section.
Bernard Kwey
how ? how should i define it
Manish
Check for your env values
Manish
Show your .env file.
Himanshu
.env file? Didn't they use that in Laravel or some PHP based system?
Himanshu
Okay, I will just observe.
Manish
Himanshu
Okay. Will google how to use .env in Django!
Manish
He associates EMAIL_HOST_USER in settings with the value of EMAIL_USER in .env file. So it must be verified that the value is properly extracting from environment variable(.env)
Leo
Manish
So that he can know where is the problem
Leo
Himanshu
Try sendgrid.com or something else?
Manish
Leo
Himanshu
Leo
@goshbak visit this link https://myaccount.google.com/lesssecureapps confirm the toggle button is on
Сергей
hi, I send a field in request, but field doesn`t exist in model, how can I receive it in serializer?
Mirco
Сергей
what I need to share, in my case I send field but it doesn`t exist in model, it`s nothing to share
Mirco
Сергей
I have not code, I don`t know how it`s doing
Mirco
Сергей
I send field in request but it there is not in obj
Titus Joyson
Сергей
class SerializerV3(serializers.ModelSerializer):
photo_data = PhotoSerializer(many=True, required=True,source='photos_auto')
class Meta:
model = ReportPodbor
depth = 1
def validate_photo_data(self, obj):
print(obj)
return obj
Сергей
pthotos_auto foreign key, рhoto_data I send in request and try receive in the serialiser, but have no idee how can I do
Titus Joyson
does Photo is a model and have relation with ReportPodbor ?
Сергей
it`s true
Titus Joyson
You can try nested serializers like this
photo_data = serializers.ListField(child=PhotoSerializer())
highnes
https://www.uphub.io/bin/ZSYiPN