Hi Folks,
I am playing around with Django and making a site for my motorcycling group.
I am trying to implement a timeline view and thought I would share my thoughts with you and get some feedback.
So far, I have a few models which can be user created. A user can add a 'bike' , or a 'place' or add 'tips' to the place. Now, I want this all to be shown in a single flow on a page. Lets say the URL for this is <mysite>/timeline.
I am trying to figure out which is the best way to aggregate this data. So, far I have been thinking of the following :
1. Create another object, which I can call "timeline" object, and when the save for any of the above objects is called, I also create a 'timeline' object, and populate with the pk and a choice_field item for the 3 models. I don't particularly like this as if I want to add a new object, I will need to make changes to multiple places.
2. I create a base model from which I derive these models. There are a few common fields for the timeline view which create the base model. However, I don't know how i can differentiate between the different model types when I implement the view & Template.
3. If there is a way to chain the objects together in a view. In this case, I don't have to change my current code much - but I could not figure out if this can be implemented. Essentially, i do a get on the different models into a meta model , sort them by creation timestamp and render in the view.
What are your thoughts ?
V.
--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius