This is probably a pretty n00b question, but i can’t get it to work.
If i have following model:
from django.contrib.auth.models import User class Entry(models.Model): title = models.CharField() users = models.ManyToManyField(User)
How would i get a list of all entry-titles of the currently logged in user? Something like:
list = Entry.objects.filter(users__????__contains = request.user)
?
Thanks in advance for helping me advance.
Off the top of my head, I believe it might be along the lines of:
or
I believe either of those should work. For more info on many to many relationships check out the Django docs.