database - Django - Model Schema for a Messaging app -


i've found lot of examples of django message apps, not 1 want. want have messages between users (1-1) , "inbox" manage them. inbox should able group messages in sort of conversation, can read whole conversation history. appropriate way this? thinking making inbox manager message objects that:

class inbox(models.manager):      # conversations between users     # handle reading, sending, etc  class message(models.model):     content = models.textfield(_('content'))     sender = models.foreignkey(auth_user_model, related_name='sent', verbose_name=_("sender"))     recipient = models.foreignkey(auth_user_model, related_name='received', verbose_name=_("recipient"))      objects = inbox 

for thinking, why i'd want inbox.. want able use app later:

inbox.send_message(to=some_user, message="hey there, whats up??") 

i'm open better ideas on how reach goal.


Comments