moo.bootstrap.get_or_create_object
- moo.bootstrap.get_or_create_object(name, unique_name=False, parents=None, owner=None, location=None, site=None)
Get or create a named object. Safe to call on an already-bootstrapped database.
- Parameters:
name (str) – The name of the object to get or create.
unique_name (bool) – Whether the object has a unique name constraint.
parents (list[Object] | None) – A list of parent objects to add if the object is newly created.
owner (Object | None) – The owner of the object.
location (Object | None) – The location of the object.
site (Site | None) – The site to associate the object with.
- Returns:
A
(object, created)tuple.- Return type:
tuple[Object, bool]