HERE IS MY MODEL:
class Course(models.Model):
title = models.CharField(max_length=100)
students = models.ManyToManyField(User,related_name="students")
crated_at = models.DateField(auto_created=True)
How can I check request user in students?
您可以使用它进行过滤:-
user_filter = Course.objects.filter(user=request.user)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.