onadata.libs.mixins package

Submodules

onadata.libs.mixins.anonymous_user_mixin module

class onadata.libs.mixins.anonymous_user_mixin.AnonymousUserMixin

Bases: object

get_queryset()

Set AnonymousUser from the database to allow object permissions.

onadata.libs.mixins.anonymous_user_public_forms_mixin module

class onadata.libs.mixins.anonymous_user_public_forms_mixin.AnonymousUserPublicFormsMixin

Bases: object

get_queryset()

Public forms only for anonymous Users.

onadata.libs.mixins.authenticate_header_mixin module

class onadata.libs.mixins.authenticate_header_mixin.AuthenticateHeaderMixin

Bases: object

get_authenticate_header(request)

onadata.libs.mixins.cache_control_mixin module

class onadata.libs.mixins.cache_control_mixin.CacheControlMixin

Bases: object

finalize_response(request, response, *args, **kwargs)

onadata.libs.mixins.etags_mixin module

class onadata.libs.mixins.etags_mixin.ETagsMixin

Bases: object

Applies the Etag on GET responses with status code 200, 201, 202

self.etag_data - if it is set, the etag is calculated from this data,
otherwise the date_modifed of self.object or self.object_list is used.
finalize_response(request, response, *args, **kwargs)
set_etag_header(etag_value, etag_hash=None)

onadata.libs.mixins.labels_mixin module

class onadata.libs.mixins.labels_mixin.LabelsMixin

Bases: object

labels(request, format='json', **kwargs)
class onadata.libs.mixins.labels_mixin.TagForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('tags', <taggit.forms.TagField object at 0x7ffa0bd729d0>)])
declared_fields = OrderedDict([('tags', <taggit.forms.TagField object at 0x7ffa0bd729d0>)])
media
onadata.libs.mixins.labels_mixin.process_label_request(request, label, instance)

Process request to labels endpoint.

Parameters:
  • request – HTTP request object.
  • label – label that is being acted on.
  • instance – object that label is applied to.
Returns:

A response object based on the type of request.

onadata.libs.mixins.last_modified_mixin module

class onadata.libs.mixins.last_modified_mixin.LastModifiedMixin

Bases: object

finalize_response(request, response, *args, **kwargs)
last_modified_date = None
last_modified_field = 'modified'

onadata.libs.mixins.multi_lookup_mixin module

class onadata.libs.mixins.multi_lookup_mixin.MultiLookupMixin

Bases: object

get_object(queryset=None)

onadata.libs.mixins.object_lookup_mixin module

class onadata.libs.mixins.object_lookup_mixin.ObjectLookupMixin

Bases: object

get_object(queryset=None)

Incase the lookup is on an object that has been hyperlinked then update the queryset filter appropriately

onadata.libs.mixins.openrosa_headers_mixin module

class onadata.libs.mixins.openrosa_headers_mixin.OpenRosaHeadersMixin

Bases: object

get_openrosa_headers(request, location=True)

onadata.libs.mixins.profiler_mixin module

class onadata.libs.mixins.profiler_mixin.ProfilerMixin

Bases: object

dispatch(request, *args, **kwargs)
get_serializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)
onadata.libs.mixins.profiler_mixin.finished(sender, **kwargs)
onadata.libs.mixins.profiler_mixin.started(sender, **kwargs)

onadata.libs.mixins.total_header_mixin module

class onadata.libs.mixins.total_header_mixin.TotalHeaderMixin

Bases: object

finalize_response(request, response, *args, **kwargs)
total_count = None

onadata.libs.mixins.xform_id_string_lookup module

class onadata.libs.mixins.xform_id_string_lookup.XFormIdStringLookupMixin

Bases: object

get_object(queryset=None)
lookup_id_string = 'id_string'

Module contents