Package expedient :: Package common :: Package utils
[hide private]
[frames] | no frames]

Package utils

source code

Submodules [hide private]

Functions [hide private]
 
create_or_update(model, filter_attrs, new_attrs={}, skip_attrs=[], using=None)
If an object is found matching filter attrs, then update the object with new_attrs else create the object with filter_attrs and new_attrs.
source code
Variables [hide private]
  __package__ = 'expedient.common.utils'
Function Details [hide private]

create_or_update(model, filter_attrs, new_attrs={}, skip_attrs=[], using=None)

source code 

If an object is found matching filter attrs, then update the object with new_attrs else create the object with filter_attrs and new_attrs. new_attrs overrides filter_attrs. To leave some keys from filter_attrs unused, specify them in skip_attrs (such as auto-created slug fields or to use default values). Returns tuple (object, created) where created is True if object is created.