1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

[1.7.x] Fixed #23611 -- update_or_create failing from a related manager

Added update_or_create to RelatedManager, ManyRelatedManager and
GenericRelatedObjectManager.
Added missing get_or_create to GenericRelatedObjectManager.

Conflicts:
	tests/generic_relations/tests.py
	tests/get_or_create/tests.py

Backport of ed37f7e979 from master
This commit is contained in:
André Ericson
2014-10-08 03:27:31 +07:00
committed by Loic Bistuer
parent dbd52f339c
commit fa4b6482df
6 changed files with 159 additions and 5 deletions

View File

@@ -42,3 +42,17 @@ class Tag(models.Model):
class Thing(models.Model):
name = models.CharField(max_length=256)
tags = models.ManyToManyField(Tag)
class Publisher(models.Model):
name = models.CharField(max_length=100)
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author, related_name='books')
publisher = models.ForeignKey(Publisher, related_name='books', db_column="publisher_id_column")