Nerd
Look into the login() function
Piyush
Okay Now run this users = User.objects.all().values(“username” print(users) # all users print(username) # username being searched So check if the username is in the users
Ok,now let me show you my code,num=str(response.session.get('name')) gml=str(response.session.get('eml')) passw=str(response.session.get('otp')) passw1=make_password(str(response.session.get('otp'))) n=SignIn(name=num,gmail=gml,password=passw1) n.save() print(num,gml,passw) user=User.objects.all().values(num) print(user) if User is not None: login(user) print(user) #error::- Cannot resolve keyword <name of client>->'Yomesh' into field. Choices are: date_joined, email, first_name, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry, password, user_permissions, username
Piyush
Now I don't understand what does importing User does,I mean is it used for,and do I have to import it in my forms and models.py too.
Piyush
Did I saved user info correctly in SignIn model.
Piyush
And do I have to put values in double inverted commas or in place of username I have to insert name of user.
Nerd
user = User.objects.all().values("username", "first_name") print(user) Type the above dont change anything
Piyush
Ok.
Piyush
It is displaying cannot resolve keyword 'Username' into field.and then choices are date_joined first_name,id,is_active...
Nerd
the username is small letters like I typed mate
Piyush
Sorry.
Piyush
Ok now it worked.
Piyush
It is showing user : my name and blank in first name.
Nerd
can you paste it here
Piyush
Yes,wait a minute.
Doragonsureiyā
Yes,wait a minute.
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Piyush
Piyush Khanduri manfein@gmail.com 71248 #user info entered at time of registration. <QuerySet [{'username': 'Piyush', 'first_name': ''}]>
Nerd
So that thing is There is no Yomesh in your database so I think your registration didnt save it
Piyush
Yonesh was the name of client who registered him self and he is present in my SignIn model data base.
Nerd
But in that SignIn mode do you have passoword?
Piyush
Like in this case Piyush khanduri is a client who want to register him self.
Piyush
Yes.
Piyush
Password.
Nerd
user = SignIn.objects.all() print(user)
Piyush
Yes it is printing the data in my data base.
Nerd
does it include Yomesh
Piyush
Yes.
Nerd
then you need to check that instead when saving the password in that model, do you encrypt the password?
Piyush
Yes,when I insert it in data base and unencrypted password in User.
Nerd
done you need to check the user there during login
Nerd
but Why do you have two tables SignIn and User
Piyush
I don't have Users I think so that Users if for admin and SignIn is for saving clients data.
Nerd
you need to restructure your db so that all users go into the Users and add a flag to check if it admin or client, this way is not efficient to achieve your session login
Piyush
Ok ,so admin will be super user and others will be staff.
Nerd
yh
Piyush
Ok I will try that, thankyou.
Ankur Patel
can anyone help me in django permission
Ankur Patel
i have added group, now i want to assign group while registration and user itself assign their role,
Lauriano
Hi Guys i am studing django, why create profile follow this articile no works ? https://www.scaler.com/topics/django/profiles-and-groups-in-django/
Lauriano
I followed this tutorial and it doesn't look like anything on my profile.
.
i have added group, now i want to assign group while registration and user itself assign their role,
You can create a custom user registration form, and add your own permission fields in it, and handle its saving method.
Piyush
yh
Really really thankyou Mr.Issaka , now I can authenticate use and again thankyou for being so patient.
Ankur Patel
hello, i want to create authentication for 3 different users, how can i do that, can i use usercreation form for all 3 or can i use differet, please help
Snezha
The static folder is in the Ham application and I need to save pictures there, that is, the path of my files Ham/static/img.img how do I get this path without Ham/ otherwise static on the path localhost:8000/Ham/static/img.img does not work image = models.ImageField(upload_to='Ham/static/img', null=True, blank=True)
Eternity
hello, i want to create authentication for 3 different users, how can i do that, can i use usercreation form for all 3 or can i use differet, please help
Just create functions in your views.py file. They will be the same for every person who wants to be authenticated
Harsh
Hey guys I am learning django to become a backend developer, can anyone list good projects from intermediate to advance to land a good job?
Eternity
Hey guys I am learning django to become a backend developer, can anyone list good projects from intermediate to advance to land a good job?
There are many good projects you can easily implement. Just search them and choose the one you really like
Bibhuti
Hey guys I am learning django to become a backend developer, can anyone list good projects from intermediate to advance to land a good job?
I cannot tell about Api development specific projects. But you can try hands on Link shortner, Password manager, Email automation, Chat application.
_
any one has link to any pdf/git repo/blogs to standard practises for unit in pytest with DRF
Maxim
thanks🙏
You're welcome! 😊
Proton
Good day everyone I’ve got a little problem and need help I bought a domain from godaddy and also purchased the office 365 email from there Funny enough I can’t get it to work with Django I’ve tried all email settings on my project but not working Anyone here who can help? Thanks
Siddhali
I am new to Django can anyone give me the complete and proper pdf or any file which helps me to learn Proper Django
Harsh
in short, there is no such list
Yeah, just a bit confused to how much should I know and learn
Harsh
I am new to Django can anyone give me the complete and proper pdf or any file which helps me to learn Proper Django
Hey I would suggest you to directly start with most basic projects and read docs while doin so
Proton
But at least should work on local host
Nerd
But at least should work on local host
I don't get you because basically the domain is a configuration of the server ip
Proton
Yeah, just a bit confused to how much should I know and learn
I think any document on Django from Packt Pub will do I don’t know if I’ve got the name right
Proton
I don't get you because basically the domain is a configuration of the server ip
So basically I need to configure the SMPT for office 365 outlook
Proton
Now I get you
Great! Cos I’ve tried ChatGPT and stackoverflow
Nerd
Yh so have gone through their official configs?