mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	[1.8.x] Fixed #24505 -- Fixed clash with hidden m2m fields.
Added support for multiple m2m fields with the same 'to' model
and with related_name set to '+'.
Backport of 4ee08958f1 from master
			
			
This commit is contained in:
		| @@ -54,9 +54,13 @@ class SelfReferChildSibling(SelfRefer): | ||||
|  | ||||
|  | ||||
| # Many-to-Many relation between models, where one of the PK's isn't an Autofield | ||||
| @python_2_unicode_compatible | ||||
| class Line(models.Model): | ||||
|     name = models.CharField(max_length=100) | ||||
|  | ||||
|     def __str__(self): | ||||
|         return self.name | ||||
|  | ||||
|  | ||||
| class Worksheet(models.Model): | ||||
|     id = models.CharField(primary_key=True, max_length=100) | ||||
| @@ -87,3 +91,10 @@ class RegressionModelSplit(BadModelWithSplit): | ||||
|     Model with a split method should not cause an error in add_lazy_relation | ||||
|     """ | ||||
|     others = models.ManyToManyField('self') | ||||
|  | ||||
|  | ||||
| # Regression for #24505 -- Two ManyToManyFields with the same "to" model | ||||
| # and related_name set to '+'. | ||||
| class Post(models.Model): | ||||
|     primary_lines = models.ManyToManyField(Line, related_name='+') | ||||
|     secondary_lines = models.ManyToManyField(Line, related_name='+') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user