Changes between Version 15 and Version 16 of DescriptorFields


Ignore:
Timestamp:
12/29/2005 11:56:09 AM (9 years ago)
Author:
rjwittams
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DescriptorFields

    v15 v16  
    113113   }}}
    114114
     115----
     116= Query Syntax =
     117
     118In further discussions about this idea, it seemed consistent that both the manager ( Person.objects ) and relationship end points, ( reporter.articles ) would act as lazy sets of instances (base class QuerySet?) , with these 'refinement' methods on them ( filter, order_by, etc).
     119
     120eg
     121
     122{{{Person.objects.get_list()}}}
     123becomes
     124{{{Person.objects}}}
     125
     126{{{Person.objects.get_list(name__startswith="R")}}}
     127becomes
     128{{{Person.objects.filter(name__startswith="R")}}}
     129
     130Query sets would be combinable with the standard set operators, which would be less clumsy than the current complex= query syntax.
     131eg
     132{{{ar_list = Person.objects.get_list(complex=Q(name_startswith="R")|Q(name_startswith="A") ) }}}
     133goes to (idiosyncratically)
     134{{{people = Person.objects
     135   ar_set = people.filter(name_startswith="R") | people.filter(name_startswith="A")
     136}}}
    115137
    116138
     139
     140----
    117141
    118142''When you finally open a ticket on this massive change ;) I'll add a comment that you should feel free to steal code from Dejavu, which has used descriptors successfully for two years now: http://projects.amor.org/dejavu/browser/trunk/units.py  -- Robert Brewer''
Back to Top