Modules¶
Admin¶
Django admin module.
Api¶
Cache¶
Module to access and save data through the Django cache system.
-
pawapp.cache.clean_value(key)[source]¶ Clean cached values.
Parameters: key (str) – Key to identify the cache value.
Forms¶
Django forms module.
-
class
pawapp.forms.CallEventForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Form to validate values of CallEvent object.
Handlers¶
Handler module for incoming data through the API
-
class
pawapp.handlers.BaseDataHandler(data)[source]¶ Base data handler
-
add_error(field, message)[source]¶ Add message error for a field.
Parameters: - field (str) – Field name.
- message (str) – Message error.
-
-
class
pawapp.handlers.BillHandler(data)[source]¶ Handler class for Bill data.
-
class
pawapp.handlers.CallEventHandler(data)[source]¶ Handler class for CallEvent data.
-
handle()[source]¶ Process CallEvent current data.
Raises: InvalidDataException– Raises if data is not valid.
-
Helpers¶
Helper functions module
-
pawapp.helpers.add_list_value(source, key, item)[source]¶ Add item to a list inside the source dict.
Parameters: - source (dict) – Source dict.
- key (str) – Field where the item will be added.
- item – Value to be added in the list.
Models¶
Django models module.
-
class
pawapp.models.Bill(*args, **kwargs)[source]¶ Model representing the phone bill.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
classmethod
data_by_number_period(phone_number, month, year)[source]¶ Return bill data by phone_number, month and year.
Parameters: - phone_number (str) – Phone number
- month (str) – Month
- year (str) – Year
-
exception
-
class
pawapp.models.BillItem(*args, **kwargs)[source]¶ Model representing the item of a Bill.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
from_date_and_time¶ From_timestamp field splited as date and time values.
-
repr_duration¶ Represent duration value.
-
exception
-
class
pawapp.models.CallEvent(*args, **kwargs)[source]¶ Model representing the call events ocurred.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
classmethod
calculate_call(call_id)[source]¶ Calculated the call value and duration charged.
Parameters: call_id (int) – Call event Id.
Returns: - Two values representing the total value and
duration calculated.
Return type: tuple
Raises: InvalidCallPairException– Raises if start or end calls are missing.InvalidCallIntervalException– Raises if end datetime is less than start datetime.
-
call_timestamp_datetime¶ Datetime call_timestamp value.
Returns: Call_timestamp value. Return type: datetime
-
exception
-
class
pawapp.models.ConnectionRate(*args, **kwargs)[source]¶ Model representing the connection rate calls.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
classmethod
current_rates(use_cache=True)[source]¶ Current rates available for calculation.
Parameters: use_cache (bool) – Should use the cache. Returns: - List with dict object with the fields:
- from_time, to_time, stangind and minute rates
Return type: list
-
classmethod
mapped_rates_interval(start_datetime, end_datetime)[source]¶ List of mapped datetime and values intervals.
This method is responsible to calculate the range of intervals between the start and end datetime with respective values.
Parameters: - start_datetime (datetime) – Start datetime object.
- end_datetime (datetime) – End datetime object.
Returns: List of intervals.
Return type: list
-
exception