Main resources¶
Entity¶
- class contacts.models.Entity(*args, **values)¶
A base class for Contact and Organization.
- classmethod get_indexable_documents(**kwargs)¶
Overrides get_indexable_documents method by filtering on only active entities
- photo_uri¶
Return the photo URI or the default empty picture.
- classmethod post_delete(sender, document, **kwargs)¶
Post delete hook handler
- Deletes related photo, if exists
- De-index entity from elasticsearch
- classmethod post_save(sender, document, created, **kwargs)¶
Post save hook handler
- Removes related TTL
- Index entity in elasticsearch
- class contacts.api.resources.EntityResource(api_name=None)¶
- get_object_list(request)¶
Filters the queryset from private results. Done here since we can extract caller user from the request
- hydrate(bundle)¶
On POST requests, sets the entity creator
- hydrate_private(bundle)¶
Ensures that the private flag can only be updated by the creator
- obj_create(bundle, **kwargs)¶
Calls the saved task here since we can extract issuer from the request
- obj_update(bundle, **kwargs)¶
Calls the saved task here since we can extract issuer from the request
Contact¶
- class contacts.models.Contact(*args, **values)¶
A wrapper to a contact entity.
- get_full_name(name_first=False, upper_name=False)¶
Returns Contact full name according to this format:
- Firstname Name, if either the name and firstname are set
- Name, if only the name is set
- Firstname, if only the firstname is set
- None, if neither the name nor the firstname are set
Parameters: name_first – invert name and firstname in the first case.