MCPcopy
hub / github.com/django/django / _check_unique

Method _check_unique

django/db/models/fields/related.py:1162–1178  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

1160 return errors
1161
1162 def _check_unique(self, **kwargs):
1163 return (
1164 [
1165 checks.Warning(
1166 "Setting unique=True on a ForeignKey has the same effect as using "
1167 "a OneToOneField.",
1168 hint=(
1169 "ForeignKey(unique=True) is usually better served by a "
1170 "OneToOneField."
1171 ),
1172 obj=self,
1173 id="fields.W342",
1174 )
1175 ]
1176 if self.unique
1177 else []
1178 )
1179
1180 def deconstruct(self):
1181 name, path, args, kwargs = super().deconstruct()

Callers 1

checkMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected