Contacts

Embedded resources

Address

class contacts.models.embedded.Address(*args, **kwargs)

An address wrapper which can be embedded in any object.

static concat_fields(field1, field2)

Method used in the get_formatted() method to concatenate fields like state and country.

get_formatted()

Returns a concatenated list of Address attributes:

  • Street address
  • Extended address, post office box
  • Postal code, City
  • State, Country
class contacts.api.resources.embedded.AddressResource(api_name=None)

Email

class contacts.models.embedded.Email(*args, **kwargs)

An e-mail wrapper which can be embedded in any object.

class contacts.api.resources.embedded.EmailResource(api_name=None)

Phone

class contacts.models.embedded.Phone(*args, **kwargs)

A phone wrapper which can be embedded in any object.

class contacts.api.resources.embedded.PhoneResource(api_name=None)

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.
class contacts.api.resources.ContactResource(api_name=None)
do_export(request, serializer, export_objects)

Contacts export

do_import(request, serializer, import_buffer)

Contacts import

prepend_urls()

Add urls for resources import/export.

Organization

class contacts.models.Organization(*args, **values)

A wrapper to an organization entity.

class contacts.api.resources.OrganizationResource(api_name=None)
do_export(request, serializer, export_objects)

Organizations export

do_import(request, serializer, import_buffer)

Organizations import

prepend_urls()

Add urls for resources import/export.

ContactGroup

class contacts.models.ContactGroup(*args, **values)

A class for grouping contacts.

Not currently used

Table Of Contents

Previous topic

Core

Next topic

Data liberation

This Page