DEV Community

Cover image for Student Management System | Django |

Student Management System | Django |

Madhuban Khatri on December 15, 2022

Student Management System is a system for Students where Students can check their details. In this system, a Admin Panel is included where admin ca...
Collapse
 
teury profile image
Teury Diaz • Edited

The model is wrong or incomplete students and teachers would never be able to log in this way. looks like code made by some AI. There is no relation to the Django user model.

Collapse
 
madhubankhatri profile image
Madhuban Khatri

Explain the problem

Collapse
 
teury profile image
Teury Diaz

After rereading the code I see that you are using many bad practices, the sections to validate the user, you do not use the authentication provided by Django. this has a big security problem. When the student or admin user tries to start the section, the information will be sent without encrypting this, anyone on the network can capture that password because django forms are not used with its passwordInput widget. remember that passwords have to be encoded in the database, which is not the case with your student model. You use a lot of bad practices, the correct way to do this is with AbstractUser or AbstractBaseUser, use a login form with a passwordInput widget (the information is sent encrypted) and use a CustomUserManager that when creating the user calls user.set_password( password) in this way the password is encoded in the database, you comply with European regulations and protect the personal information of users.

Thread Thread
 
madhubankhatri profile image
Madhuban Khatri

So I have to use-

  • Authentication and Autherization

  • AbstractUser or AbstractBaseUser

Thread Thread
 
teury profile image
Teury Diaz

Yes, that would be the correct way. You can also add a OneToOneField to the student and teacher model, that way you can keep the models you already have. I will leave you the best tutorial that explains this whole topic very well: simpleisbetterthancomplex.com/tuto...

Thread Thread
 
django_aj_4c2bd89ff395f6a profile image
django aj

did you finished the "college management system" project ?
can you share the code with me ?
i also want to learn and build "college management system" type projects

Collapse
 
django_aj_4c2bd89ff395f6a profile image
django aj • Edited

did you finished the "college management system" project ?
can you share the code with me ?
i also want to learn and build "college management system" type projects

Collapse
 
bordik profile image
bordik

How can admin login ?
I'm trying to log in with the email and password I created
python manage.py createsuperuser
which does not happen, the page is not updated
authorization by the administrator does not occur
there is no transition to the page 127.0.0.1:8000/admin_panel/dashboard

Collapse
 
madhubankhatri profile image
Madhuban Khatri

Here is adminLogin function views.py file. You have to use admin@gmail.com for the email and admin@123 for the password.

Collapse
 
gnasirsky profile image
gnasirsky

some problem in this code ....please help

Collapse
 
madhubankhatri profile image
Madhuban Khatri

what problem? Explain me.