I have a model:
class application(models.Model):
STATUS_CHOICES = [
('applied', 'Applied'),
('assessment','Assessment'),
('interview', 'Interview'),
('accepted', 'Accepted'),
]
JOB_TYPE = [
('entry level', 'Entry Level'),
('internship','Internship'),
('graduate scheme', 'Graduate Scheme'),
('senior', 'Senior'),
]
job_position = models.CharField(max_length=150)
company = models.CharField(max_length=150)
salary = models.IntegerField()
status = models.CharField(max_length=15, choices=STATUS_CHOICES)
job_type = models.CharField(max_length=15, choices=JOB_TYPE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
Lets say I create a form without including the user as a field, how can I say that the user is automatically the user than is logged in ( authenticated ). Do I use request.user
somewhere?