Ticket #28266: 16df9cb6cc6188a53de32bbdcbb25fba54d83aa5.patch

File 16df9cb6cc6188a53de32bbdcbb25fba54d83aa5.patch, 1002 bytes (added by Lachlan Musicman, 7 years ago)

Patch file

  • docs/ref/models/instances.txt

    From 16df9cb6cc6188a53de32bbdcbb25fba54d83aa5 Mon Sep 17 00:00:00 2001
    From: Lachlan Musicman <datakid@gmail.com>
    Date: Fri, 2 Jun 2017 11:08:05 +1000
    Subject: [PATCH] Update from_db in instance.txt
    
    The from_db example didn't work - creating a new instance called new, then referring to instance. Needed to be one or the other.
    ---
     docs/ref/models/instances.txt | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
    index 3077a22ef23..ae560a6a72e 100644
    a b are loaded from the database::  
    9999                values.pop() if f.attname in field_names else DEFERRED
    100100                for f in cls._meta.concrete_fields
    101101            ]
    102         new = cls(*values)
     102        instance = cls(*values)
    103103        instance._state.adding = False
    104104        instance._state.db = db
    105105        # customization to store the original field values on the instance
Back to Top