I have a model which has a boolean field:
class Library(SocialLinksModelMixin):
"""
Represents book shelves and places where people have / leave books.
"""
user = models.ForeignKey(...)
is_main = models.BooleanField(default=False)
User can have multiple Libraries and I would like to allow setting the main one to ease the flow in the app.
What is the easiest way for switching only one Library is_main to True and all others to False (There is always only 1 Library for a user that is main)
I'm thinking about querying for all libraries and updating each and every one. Maybe there is another way to do that functionality?