My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 3: support for descriptors
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by aljosa.mohorovic, Mar 05, 2009
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.
wadofstuff_descriptors.txt
4.5 KB   Download
Sign in to add a comment

Hosted by Google Code