The apps module contains classes and functions that deal with FoneAstra apps, which enable a Django app to be discoverable by the FoneAstra framework and facilitate communication between FoneAstra devices and the server.
This is the core app that all FoneAstra apps should subclass. This class also includes extra methods and fields for interfacing with FoneAstra, and FoneAstra autodiscovery only includes apps that subclass FoneAstraApp.
This should be the name of the app. For instance, an application designed for use in a milk bank should set app_name to “Milk Bank” in its subclass.
Example:
app_name = "Milk Bank"
The app’s index view, as a reverse name. Override this in subclasses.
Example:
app_index = "mb_index"
An iterable of class objects in this app that subclass FoneAstraDevice. Only devices with their type listed in this iterable will have their instance receive method called when they send a message to the server.
Example:
from mb.models import MilkBankDevice
device_types = (MilkBankDevice,)
This method gets called if a message arrives that did not come from any registered FoneAstra device in any app. This method is most frequently called for configuration messages.
Parameters: | msg (fa.models.IncomingMessage) – The incoming message. |
---|
Returns all FoneAstraApp subclasses defined in all apps in INSTALLED_APPS.
Returns the FoneAstra device with the given phone number and with a type contained in device_types, or None if no such device exists.
Parameters: | phone_number (string) – The phone number corresponding to the device. |
---|