Ticket #7435: 7435.newdocs.diff

File 7435.newdocs.diff, 1.1 KB (added by Marc Fargas, 16 years ago)

New patch (fixes conflict in docs)

  • django/db/models/base.py

    diff --git a/django/db/models/base.py b/django/db/models/base.py
    index 115d82b..1bc273b 100644
    a b class Model(object):  
    426426        return force_unicode(dict(field.flatchoices).get(value, value), strings_only=True)
    427427
    428428    def _get_next_or_previous_by_FIELD(self, field, is_next, **kwargs):
     429        if not self.pk:
     430            raise ValueError("get_next/get_previous cannot be used on unsaved objects.")
    429431        op = is_next and 'gt' or 'lt'
    430432        order = not is_next and '-' or ''
    431433        param = smart_str(getattr(self, field.attname))
  • docs/ref/models/instances.txt

    diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
    index 404d473..eeba653 100644
    a b described in :ref:`Field lookups <field-lookups>`.  
    428428
    429429Note that in the case of identical date values, these methods will use the ID
    430430as a fallback check. This guarantees that no records are skipped or duplicated.
     431
     432That also means you cannot use those methods on unsaved objects.
Back to Top