Making existing ready database able to log in as user without sign up

Hello everyone
I am working for project in django but I am still a beginner
I have an existing ready database: Students
And I can sign up with me users and add new data to database of users
just users can log in to the website but I do not need to sign up users anymore just I want to make students being able to log in to the site then system check if the entered information is existed in the data of students after that let to log in or don’t
what should I do

this is my models:
class Student(models.Model):
university_name = models.ForeignKey(University_name, on_delete=models.CASCADE)
student_id = models.PositiveIntegerField(primary_key=True)
student_name_surname = models.CharField(max_length=30)
college = models.CharField(max_length=255, default=‘SOME STRING’)
program = models.CharField(max_length=255, default=‘SOME STRING’)
year = models.IntegerField()
image = models.ImageField(blank=True, upload_to=‘images/’)
status = models.CharField(max_length=10, choices=STATUS)
slug = models.SlugField()
parent = models.ForeignKey(‘self’,blank=True, null=True, related_name=‘children’, on_delete=models.CASCADE)
create_at = models.DateTimeField(auto_now_add=True)
update_at = models.DateTimeField(auto_now=True)

def _str_(self):
    return self.student_name_surname

Probably the easiest thing to do would be to disable whatever views you’re using that allow people to sign up. (If you remove / disable those urls, then people won’t be able to access the views referenced by those urls.)

yes but my problem is that I want existing database of students to be able to log in

I’m not talking about disabling the views for logging in, just the facility for registering a new user.
They’re two different processes.

I understood you but this is not my problem yes I can disable the views of the button of the register but how to make a relationship with students to be able to log in to the system

First, you need to make yourself very familiar with the Django User authentication system. Once you’re familiar with how users are authenticated to a Django app, you’ve then got at least two options:

  • You can turn your Student model into a “User profile model” by creating User objects for each Student and adding the OneToOne field in Student to relate it to those new User objects.

  • You can use the data you collected as the source of data for a custom User model. (Note, this is not as easy as it may seem if this is a project that you’ve been working on for a while. See the warnings in the section Changing to a custom user model mid-project.

1 Like

Ok I will work to solve this by the first way, thank you very much