Chat
This package contains all models for the author and user chats
Chat Message
- class integreat_cms.cms.models.chat.chat_message.ChatHistoryManager(*args, **kwargs)[source]
Bases:
Manager
Custom manager for returning the chat history of the last x days (as configured in
AUTHOR_CHAT_HISTORY_DAYS
)- get_queryset() QuerySet [source]
Custom queryset with applied filters to return the chat messages of the last x days
- Returns:
The QuerySet of the most recent chat history
- Return type:
QuerySet
- class integreat_cms.cms.models.chat.chat_message.ChatMessage(*args, **kwargs)[source]
Bases:
AbstractBaseModel
A model for a message in the author chat
- Parameters:
id (BigAutoField) – Primary key: ID
text (TextField) – Content
sent_datetime (DateTimeField) – Sent date
Relationship fields:
- Parameters:
sender (
ForeignKey
toUser
) – Sender (related name:chat_messages
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<ChatMessage: ChatMessage object (id)>
. It is used for logging.- Returns:
The canonical string representation of the chat message
- Return type:
- history = <integreat_cms.cms.models.chat.chat_message.ChatHistoryManager object>[source]
Django manager to access the ORM Use
ChatMessage.objects.all()
to fetch all objects.A manager for the most recent chat history
- objects = <django.db.models.Manager object>[source]
Django manager to access the ORM Use
ChatMessage.objects.all()
to fetch all objects.The default manager
User Chat
- class integreat_cms.cms.models.chat.user_chat.ABTester(*args, **kwargs)[source]
Bases:
AbstractBaseModel
A helper model for keeping track of A/B testers for the chat feature
- Parameters:
id (BigAutoField) – Primary key: ID
device_id (CharField) – Device id
is_tester (BooleanField) – Is tester
Relationship fields:
- Parameters:
region (
ForeignKey
toRegion
) – Region (related name:abtester
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- class integreat_cms.cms.models.chat.user_chat.UserChat(*args, **kwargs)[source]
Bases:
AbstractBaseModel
,ZammadAPI
A model for a user (app) chat, mapping a device ID to a Zammad ticket ID
- Parameters:
id (BigAutoField) – Primary key: ID
device_id (CharField) – Device id
zammad_id (IntegerField) – Zammad id
Relationship fields:
- Parameters:
region (
ForeignKey
toRegion
) – Region for Chat (related name:chats
)language (
ForeignKey
toLanguage
) – Language of chat app user (related name:chats
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- class integreat_cms.cms.models.chat.user_chat.UserChatManager(*args, **kwargs)[source]
Bases:
Manager
custom manager providing function to get the current chat
- create(region: Region, device_id: str, language: Language) UserChat [source]
Override super create method to create a Zammad ticket for each new chat