1๐
user.favorite_things
anduser.favs_users
get same object..?
No, user.favorite_thing.all()
will get you a queryset of Thing
objects, whereas user.favs_user.all()
will get you a queryset of related Fav
objects.
The Fav
objects that you get with user.favs_user.all()
will thus point to the Thing
objects that you get by user.favorite_thing.all()
. If your Fav
objects contains more data, for example the timestamp when you made that Thing
your favorite, it thus can be sometimes useful to fetch the Fav
objects instead and then thus enumerate over the .thing
s that these Fav
objects refer to.
The related_name=โฆ
s look a bit odd. Typically it is the name to fetch the relation in reverse. Perhaps it is better to rename the favs_user
to favorites
or something.