Design question?

Posted by Mohamed on Stack Overflow See other posts from Stack Overflow or by Mohamed
Published on 2010-05-13T00:46:06Z Indexed on 2010/05/13 0:54 UTC
Read the original article Hit count: 176

Filed under:
|
|
|

I am building music app, where user can do several tasks including but not limited to listening song, like song, recommend song to a friend and extra. currently I have this model:

class Activity(models.Model):
    activity = models.TextField()
    user = models.ForeignKey(User)
    date = models.DateTimeField(auto_now=True)

so far I thought about two solutions. 1. saving a string to database. e.g "you listened song xyz" 2. create a dictionary about the activity and save to the database using pickle or json. e.g.

dict_ = {"activity_type":"listening", "song":song_obj}

I am leaning to the second implementation, but not quite sure.

so what do you think about those two methods? do you know better way to achieve the goal?

© Stack Overflow or respective owner

Related posts about django

Related posts about python