Chat
This package contains all models for the author and user chats
Attachment Map
- class integreat_cms.cms.models.chat.attachment_map.AttachmentMap(*args, **kwargs)[source]
Bases:
AbstractBaseModel
A model for a mapping a random hash to a Zammad attachment ID
- Parameters:
id (BigAutoField) – Primary key: ID
random_hash (CharField) – Random hash
article_id (IntegerField) – Article id
attachment_id (IntegerField) – Attachment id
mime_type (CharField) – Mime type
Relationship fields:
- Parameters:
user_chat (
ForeignKey
toUserChat
) – User chat (related name:attachments
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
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
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
most_recent_hits (TextField) – Most recent hits
Relationship fields:
- Parameters:
region (
ForeignKey
toRegion
) – Region for Chat (related name:chats
)language (
ForeignKey
toLanguage
) – Language of chat app user (related name:chats
)
Reverse relationships:
- Parameters:
attachments (Reverse
ForeignKey
fromAttachmentMap
) – All attachments of this user chat (related name ofuser_chat
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<UserChat: UserChat object (id)>
. It is used for logging.- Returns:
The canonical string representation of the user chat
- Return type: