Ticket #8419: option1-create-patch.diff

File option1-create-patch.diff, 783 bytes (added by Richard Davies <richard.davies@…>, 16 years ago)

Moving to create(), this enforces a similar force_insert=True - my preferred solution

  • django/db/models/query.py

     
    308308        and returning the created object.
    309309        """
    310310        obj = self.model(**kwargs)
    311         obj.save()
     311        obj.save(force_insert=True)
    312312        return obj
    313313
    314314    def get_or_create(self, **kwargs):
  • docs/ref/models/querysets.txt

     
    556556and::
    557557
    558558    p = Person(first_name="Bruce", last_name="Springsteen")
    559     p.save()
     559    p.save(force_insert=True)
    560560
    561561are equivalent.
    562562
Back to Top