Integration within a multi-app project¶
There are two mechanisms to help integrating djaodjin-saas within a project composed of multiple Django applications.
Overriding models
Replacing default functions
For example, djaoapp is a project which ties djaodjin-saas with other Django applications into a boilerplate Software-as-a-Service (SaaS) WebApp.
Overriding models¶
Profiles are defined through the Organization model. It is often useful for composition of Django apps to use a single profile model. This is possible by defining the settings SAAS_ORGANIZATION_MODEL.
User/Profile relationships are implemented through the Role model. It is often useful for composition of Django apps to use a single role model. This is possible by defining the settings SAAS_ROLE_MODEL. If you do so, you will most likely also need to implement a serializer and define SAAS[‘ROLE_SERIALIZER’].
If the AUTH_USER_MODEL
(as returned by get_user_model
) has been
overridden, both SAAS['USER_SERIALIZER']
and
SAAS['USER_DETAIL_SERIALIZER']
should be defined and implement a user
model serialization as used in API calls for the summary and detailed contact
information respectively.
Replacing default functions¶
- saas.settings.BROKER_CALLABLE = 'cowork'¶
overrides the implementation of saas.models.get_broker This function must return an Organization instance. It is often necessary to override the default implementation when you are dealing with a Web hosting service and each Website has its own database of users, profiles, etc.
- saas.settings.BUILD_ABSOLUTE_URI_CALLABLE = None¶
overrides the implementation of saas.utils.build_absolute_uri This function must return fully qualified URL. It is often necessary to override the default implementation when you are dealing with a Web hosting service and each Website has its own database of users, profiles, etc.
- saas.settings.PICTURE_STORAGE_CALLABLE = None¶
A callable function which returns a Storage object that will be used to upload a contact picture
- saas.settings.PRODUCT_URL_CALLABLE = None¶
overrides the implementation of saas.mixins.product_url This function must return a absolute URL from a provider, subscriber, plan and request arguments, all of which except the provider can be None. For example, the default implementation returns either: /app/, or /app/{subscriber}/, or /app/{subscriber}/{plan}/.