Ticket #1281: 1281_patch2.diff

File 1281_patch2.diff, 1.6 KB (added by python@…, 19 years ago)

updated patch fixing more...

  • c:/python24/lib/site-packages/django-0.91-py2.4.egg/django/core/meta/__init__.py

     
    460460        for f in to_search:
    461461            if f.name == name:
    462462                return f
     463        if (hasattr(self, 'one_to_one_field') and
     464            self.one_to_one_field is not None and
     465            self.one_to_one_field.name == name):
     466            return self.one_to_one_field
    463467        raise FieldDoesNotExist, "name=%s" % name
    464468
    465469    def get_order_sql(self, table_prefix=''):
     
    18431847                    # case, because they'll be dealt with later.
    18441848
    18451849                    if f == related.field:
    1846                         param = getattr(new_object, related.field.rel.field_name)
     1850                        to = related.field.rel.to
     1851                        if (hasattr(to, 'one_to_one_field') and
     1852                            to.one_to_one_field and
     1853                            to.one_to_one_field.name == related.field.rel.field_name):
     1854                            param = getattr(new_object, related.field.rel.field_name + '_id')
     1855                        else:
     1856                            param = getattr(new_object, related.field.rel.field_name)
    18471857                    elif add and isinstance(f, AutoField):
    18481858                        param = None
    18491859                    elif change and (isinstance(f, FileField) or not child_follow.get(f.name, None)):
Back to Top