i needed to serialize some values from descriptors so i modified few things
and added "descriptors" argument.
it works like this:
serialize("json", (somemodel,), ensure_ascii=False, relations={
'users':{
'fields':('date_joined',),
'extras':('get_full_name',),
'descriptors':{
'mymodel_count':('mymodel_set.count',),
'mymodel_instance_method':('mymodel_set.all.0.method_with_args', 55),
#'mymodel_model':('mymodel_set.all.0',),
#'mymodel_qs':('mymodel_set.all',),
}
}})
format for descriptor field is "field":arguments where first item in
arguments is object value path.
if len(arguments) > 1 callable will be called with arguments[1:]
this is quick and dirty hack that works ok for my current problem but i was
wondering if you plan to add something similar to this project or suggest a
better way to access descriptors data?
attached file is svn diff.
Original issue reported on code.google.com by aljosa.m...@gmail.com on 5 Mar 2009 at 6:39
Original issue reported on code.google.com by
aljosa.m...@gmail.com
on 5 Mar 2009 at 6:39Attachments: