Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Added first stab at many-to-one descriptor lookup. Now…

… poll_obj.choice_set is created. poll_obj.get_choice_list(), poll_obj.get_choice() and poll_obj.get_choice_count() are still supported temporarily, but that code was marked with a TODO to be deleted.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2141 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b22ebaf466fe7a0d056eb7ef96299e18b72db7ea 1 parent a6139af
Adrian Holovaty authored
2  django/db/models/base.py
@@ -202,7 +202,7 @@ def __collect_sub_objects(self, seen_objs):
202 202
         seen_objs.setdefault(self.__class__, {})[pk_val] = self
203 203
 
204 204
         for related in self._meta.get_all_related_objects():
205  
-            rel_opts_name = related.get_accessor_name()
  205
+            rel_opts_name = related.OLD_get_accessor_name()
206 206
             if isinstance(related.field.rel, OneToOne):
207 207
                 try:
208 208
                     sub_obj = getattr(self, 'get_%s' % rel_opts_name)()
45  django/db/models/fields/related.py
@@ -6,6 +6,7 @@
@@ -61,6 +62,38 @@ def do_related_class(self, other, cls):
@@ -151,7 +184,13 @@ def contribute_to_class(self, cls, name):
@@ -206,7 +245,7 @@ def contribute_to_class(self, cls, name):
@@ -296,7 +335,7 @@ def contribute_to_class(self, cls, name):
2  django/db/models/manipulators.py
@@ -154,7 +154,7 @@ def save(self, new_data):
154 154
                     if self.change:
155 155
                         if rel_new_data[related.opts.pk.name][0]:
156 156
                             try:
157  
-                                old_rel_obj = getattr(self.original_object, 'get_%s' % related.get_accessor_name() )(**{'%s__exact' % related.opts.pk.name: rel_new_data[related.opts.pk.attname][0]})
  157
+                                old_rel_obj = getattr(self.original_object, 'get_%s' % related.OLD_get_accessor_name() )(**{'%s__exact' % related.opts.pk.name: rel_new_data[related.opts.pk.attname][0]})
158 158
                             except ObjectDoesNotExist:
159 159
                                 pass
160 160
 
21  django/db/models/related.py
@@ -44,7 +44,7 @@ def extract_data(self, data):
@@ -80,19 +80,12 @@ def bind(self, field_mapping, original, bound_related_object_class=BoundRelatedO

0 notes on commit b22ebaf

Please sign in to comment.
Something went wrong with that request. Please try again.