mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
committed by
Mariusz Felisiak
parent
08f0778885
commit
f479df7f8d
@@ -32,8 +32,10 @@ class CustomManyToManyField(RelatedField):
|
||||
)
|
||||
self.swappable = swappable
|
||||
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."
|
||||
if kwargs['rel'].through is not None and self.db_table is not None:
|
||||
raise ValueError(
|
||||
'Cannot specify a db_table if an intermediary model is used.'
|
||||
)
|
||||
super().__init__(
|
||||
related_name=related_name,
|
||||
related_query_name=related_query_name,
|
||||
|
||||
Reference in New Issue
Block a user