1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #32676 -- Prevented migrations from rendering related field attributes when not passed during initialization.

Thanks Simon Charette for the implementation idea.
This commit is contained in:
David Wobrock
2021-04-28 21:15:26 +02:00
committed by Mariusz Felisiak
parent b746596f5f
commit b9df2b74b9
4 changed files with 80 additions and 13 deletions

View File

@@ -34,7 +34,12 @@ class CustomManyToManyField(RelatedField):
self.db_table = db_table
if kwargs['rel'].through is not None:
assert self.db_table is None, "Cannot specify a db_table if an intermediary model is used."
super().__init__(**kwargs)
super().__init__(
related_name=related_name,
related_query_name=related_query_name,
limit_choices_to=limit_choices_to,
**kwargs,
)
def contribute_to_class(self, cls, name, **kwargs):
if self.remote_field.symmetrical and (