Django | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

Django

How to create user login and sign up without using built in django forms in django? Any help is appreciated .Thank you in advanced.

12th Aug 2018, 10:02 AM
Rstar
Rstar - avatar
7 Answers
12th Aug 2018, 1:09 PM
Maninder $ingh
Maninder $ingh - avatar
+ 4
I'm making a more detailed web app for your subject matter but heres a good reference for the time being : https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Forms
13th Aug 2018, 6:25 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 3
try it yourself first and then if you get stuck someone will help you for sure
12th Aug 2018, 10:05 AM
GoodOldTimes
GoodOldTimes - avatar
0
pyrhob
14th Aug 2018, 1:09 PM
Arun prakash Singh
Arun prakash Singh - avatar
14th Aug 2018, 1:09 PM
Arun prakash Singh
Arun prakash Singh - avatar
0
To create user login and sign up without using built-in Django forms, you can follow the following steps: Create a LoginForm and SignupForm class in a forms.py file in your Django application directory. These classes will inherit from the django.forms.Form class. In each class, define the form fields you want to include, such as username, email, and password. You can use the django.forms.CharField and django.forms.EmailField classes for text input and email input fields respectively, and the django.forms.PasswordInput class for password fields. In the views.py file, import the LoginForm and SignupForm classes you defined in the forms.py file. Create a view function for the login page and sign up page. In the view functions, create instances of the LoginForm and SignupForm classes and pass them to the corresponding templates. In the template files for the login and sign up pages, use the form.as_p method to render the form fields as HTML. You can also add any additional markup or styling to the templates as needed. In the views.py file, create another view function to handle form submissions. In this function, you can use Django's built-in authenticate() and login() functions to authenticate the user and log them in if the form data is valid. Finally, create URLs for the login and sign up pages in the urls.py file, and map them to the corresponding view functions.
31st Mar 2023, 7:12 AM
varsha dixit
varsha dixit - avatar
0
To create user login and sign up functionality in Django without using built-in forms, you can follow these steps: 1-Create a new Django app in your project. You can do this by running the following command in your project's root directory. 2-Define the user model in your app's models.py file. You can use Django's built-in AbstractBaseUser and BaseUserManager classes to define a custom user model. 3-Create views for user login and sign up in your app's views.py file. 4-Define forms for user login and sign up in your app's forms.py file.
17th Apr 2023, 6:45 AM
varsha dixit
varsha dixit - avatar