Changes between Version 6 and Version 7 of DescriptorFields


Ignore:
Timestamp:
12/13/2005 11:45:42 AM (10 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DescriptorFields

    v6 v7  
    6161
    6262   ManyToMany examples: (from http://www.djangoproject.com/documentation/models/many_to_many/ )
     63 
    6364   {{{
    6465       a1.set_publications([p1.id])
    6566   }}}     
     67
    6668   goes to 
     69
    6770   {{{    a1.publication_set.clear()
    6871          a1.publication_set.add(p1)
    6972   }}}
     73
    7074   This looks a bit odd because of the clear call . In reality, most of the time you don't want to replace a whole set of many-to-manys, so the new api is more convenient than the old one. The methods are precisely those of a Python 2.4 built in set.
    7175   ----
     76
    7277   {{{
    7378          a2.set_publications([p1.id])
    7479          a2.set_publications([p1.id, p2.id])
    7580   }}}
     81
    7682   goes to
     83
    7784   {{{ 
    7885          a2.publication_set.clear()
     
    8188          a2.publication_set.update([p1,p2])
    8289   }}}
     90
    8391   or idiomatically
     92
    8493   {{{
    8594         a2.publication_set.clear()
     
    92101     p1.get_article_list(order_by=['headline'])
    93102   }}}
     103
    94104   goes to
     105
    95106   {{{
    96107     p1.article_set.order_by('headline')
    97108   }}}
    98109
    99 }}}
    100 ==
    101110
    102111
     112
Back to Top