Ticket #18098: order_wrt.diff
File order_wrt.diff, 1.2 KB (added by , 13 years ago) |
---|
-
django/db/models/base.py
233 233 # defer creating accessors on the foreign class until we are 234 234 # certain it has been created 235 235 def make_foreign_order_accessors(field, model, cls): 236 # Derive method name from related_name if defined (and if not 237 # a self-join). 238 if field.rel.to != cls and field.rel.related_name: 239 related_name = field.rel.related_name 240 else: 241 related_name = cls.__name__.lower() 236 242 setattr( 237 243 field.rel.to, 238 'get_%s_order' % cls.__name__.lower(),244 'get_%s_order' % related_name, 239 245 curry(method_get_order, cls) 240 246 ) 241 247 setattr( 242 248 field.rel.to, 243 'set_%s_order' % cls.__name__.lower(),249 'set_%s_order' % related_name, 244 250 curry(method_set_order, cls) 245 251 ) 246 252 add_lazy_relation(