MCPcopy
hub / github.com/django/django / check_unique

Method check_unique

django/contrib/gis/utils/layermapping.py:328–342  ·  view source on GitHub ↗

Check the `unique` keyword parameter -- may be a sequence or string.

(self, unique)

Source from the content-addressed store, hash-verified

326 return sr
327
328 def check_unique(self, unique):
329 "Check the `unique` keyword parameter -- may be a sequence or string."
330 if isinstance(unique, (list, tuple)):
331 # List of fields to determine uniqueness with
332 for attr in unique:
333 if attr not in self.mapping:
334 raise ValueError
335 elif isinstance(unique, str):
336 # Only a single field passed in.
337 if unique not in self.mapping:
338 raise ValueError
339 else:
340 raise TypeError(
341 "Unique keyword argument must be set with a tuple, list, or string."
342 )
343
344 # Keyword argument retrieval routines.
345 def feature_kwargs(self, feat):

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected