Monday, January 30, 2012

Creating a hierarchy of objects in my


I am playing around with tastypie and i want to create a hierarchy of

What i currently have is this:

class keywordResource(ModelResource):
tweets = fields.ToManyField(timelineResource, 'tweets', full=True)
class Meta:
queryset = Keyword.objects.all()
resource_name = 'keyword'
excludes = ['id', 'keyword_id']
include_resource_uri = False

def alter_list_data_to_serialize(self, request, data_dict):
if isinstance(data_dict, dict):
if 'meta' in data_dict:
# Get rid of the "meta".
# Rename the objects.
data_dict['keyword'] = copy.copy(data_dict['objects'])
return data_dict

Can someone explain the relationship to me in creating such a

in the line tweets = fields.ToManyField(timelineResource, 'tweets',

it means that timelineResource is a child of Keyword right? and
"tweets" would be the column name in timeline table or just a generic

or must i map a matching column that appears in both tables (keyword,

Thank you

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment