Ticket #887: django.core.meta.init.diff

File django.core.meta.init.diff, 762 bytes (added by mcroydon, 14 years ago)

Move old_rel_object outside the if clause so it exists to be checked in all cases.

  • django/core/meta/__init__.py

     
    15941594
    15951595            # Get a reference to the old object. We'll use it to compare the
    15961596            # old to the new, to see which fields have changed.
     1597            old_rel_obj = None
    15971598            if change:
    1598                 old_rel_obj = None
    15991599                if rel_new_data[rel_opts.pk.name][0]:
    16001600                    try:
    16011601                        old_rel_obj = getattr(self.original_object, 'get_%s' % opts.get_rel_object_method_name(rel_opts, rel_field))(**{'%s__exact' % rel_opts.pk.name: rel_new_data[rel_opts.pk.attname][0]})
Back to Top