Picture a simple messaging app written in Django. Users have the option to delete messages at any time, but the messages need to be retained in the database. There are two options:
Message. Then the call
user.messages.all()would be replaced with
user.messages.filter(deleted=False)everywhere in the code. This seems like it could create hidden bugs and is unintuitive.
Create a separate
DeletedMessageobject. This violates the principle of having similar data in one place, but allows for simpler method calls (i.e.
Which method is better?