乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
Idk anymore unless I see your code
https://hastebin.com/share/uwuqeneyul.kotlin
Mohammad Hossein
https://hastebin.com/share/uwuqeneyul.kotlin
Doesn't it throw an error about request.POST doesn't have password1 or something like this?
乇PIPHANY❦▧▧❄️
Doesn't it throw an error about request.POST doesn't have password1 or something like this?
no if i specify a box password in one of the boxes at all it'll return password doesn't match like I want buh if the password word does match and every other boxs are filled it still returns fill in the boxes and redirects as though that if statement can be never fulfilled
Mohammad Hossein
I'm not sure if the user doesn't provide one of the fields, then it doesn't exist in POST data or it's just an empty string. In the first case your code will throw errors because you did like username = request.POST['username'] and request.POST has no key named "username". However in the second case you should check all of the fields like what i said before https://t.me/django/281122
Charly
He forgot quotations
But that's pointless if he already has the user in the first line of the function
乇PIPHANY❦▧▧❄️
username in request.POST What did you tried to do here? Because that will always be false.
it's username not in request.post I'm trying to check if there's any missing value in the form before creating an account so accounts without or username don't exist
Charly
Sorry second line
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
the username = request.post['username']?!
Mohammad Hossein
I'm lost
I think you should clarify request.POST and what's its content for yourself Try printing it
乇PIPHANY❦▧▧❄️
Yes
well I did the same for email and accounts still get created without email being given
Mohammad Hossein
Try it
So we wait until I arrive home😁
乇PIPHANY❦▧▧❄️
Charly
So we wait until I arrive home😁
It is pointless to go the doctor without the patient 🤷‍♂
Charly
how do I do that
Check that is not null or empty
Charly
Not if the key exists on the POST
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
aight
Mohammad Hossein
It is pointless to go the doctor without the patient 🤷‍♂
I just mean I don't have access to my PC anywhere else
乇PIPHANY❦▧▧❄️
Charly
ehm
What?
乇PIPHANY❦▧▧❄️
how do I do that I tried username ==none
Charly
It is better to use is None but that should work
乇PIPHANY❦▧▧❄️
Charly
yes
More specifically?
乇PIPHANY❦▧▧❄️
Charly
And the check for empty string ?
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
how do I do the latter ?
Charly
how do I do the latter ?
Compare it with an empty string
Mohammad Hossein
I suggest request.POST.get('key', None)
Mohammad Hossein
I suggest request.POST.get('key', None)
The if statement will work both for none or empty string
Mohammad Hossein
乇PIPHANY❦▧▧❄️
hollup
Charly
Yes but easier
Is the same check
乇PIPHANY❦▧▧❄️
I think there's been a breakthrough
乇PIPHANY❦▧▧❄️
lemme check well
Charly
In fact the None check is worthless right now unless he change it to that
乇PIPHANY❦▧▧❄️
yayy
Mohammad Hossein
yayy
Good news?
乇PIPHANY❦▧▧❄️
Compare it with an empty string
so the two of them couldn't work simultaneously it returned a syntax error buh comparing it to an empty string alone seems to have worked many many thanks
乇PIPHANY❦▧▧❄️
Good news?
indeed many thanks as well I sent the solution
乇PIPHANY❦▧▧❄️
Mohammad Hossein
乇PIPHANY❦▧▧❄️
They can work simultaneously
perhaps maybe putting a ',' instead of 'and' while in a bracket may have worked
Charly
Maybe you need to review your basic concepts of python
乇PIPHANY❦▧▧❄️
May I see the final code?
https://hastebin.com/share/isehesetax.kotlin
Mohammad Hossein
https://hastebin.com/share/isehesetax.kotlin
I guess that will be always a True
乇PIPHANY❦▧▧❄️
No, and is fine
oh yeah I was missing a word
乇PIPHANY❦▧▧❄️
Charly
yeah
So it is useless
Charly
That's not how to do multiple comparisons use the and operator
乇PIPHANY❦▧▧❄️
So it is useless
it's not it's always true until the username contains a value in other words a none empty string
Charly
it's not it's always true until the username contains a value in other words a none empty string
No because you are not doing comparisons there, you just filled a tuple with booleans and evaluating a non empty tuple is always true
Mohammad Hossein
Learn about useful operators in if statements
乇PIPHANY❦▧▧❄️
No because you are not doing comparisons there, you just filled a tuple with booleans and evaluating a non empty tuple is always true
I don't really understand I only made it a tuple to reduce writing three different elifs to compare to an empty string isn't it comparing the individual objects like checking email == "" etc
乇PIPHANY❦▧▧❄️
that's what I believe I'm doing
乇PIPHANY❦▧▧❄️
(False, True, True) == True
and that's the aim no?