chat.models#

Conversation - data models.

Module Contents#

Classes#

Conversation

Represents a chat conversation.

Participant

Represents a chat participant (person or bot).

Message

Represents a message in a conversation.

MessageOption

Represents one of the options given to the user.

Functions#

class Conversation(*args, **kwargs)#

Bases: django.db.models.Model

Represents a chat conversation.

class Meta#
verbose_name#
verbose_name_plural#
id#
name#
created_at#
__str__()#

Return str(self).

Return type:

str

class Participant(*args, **kwargs)#

Bases: django.db.models.Model

Represents a chat participant (person or bot).

class Meta#
verbose_name#
verbose_name_plural#
id#
name#
HUMAN = 'H'#

a human participant

BOT = 'B'#

a bot participant

TYPE_CHOICES = [(), ()]#
type#
conversation#
is_required#
__str__()#

Return str(self).

Return type:

str

__repr__()#

Return repr(self).

Return type:

str

_attachment_name(m, _fn)#
Parameters:
Return type:

str

class Message(*args, **kwargs)#

Bases: django.db.models.Model

Represents a message in a conversation.

class MessageType#

Bases: django.db.models.TextChoices

Contains types of messages.

Initialize self. See help(type(self)) for accurate signature.

SYSTEM = ('S',)#

Messages generated by the system

TEXT = ('T',)#

Text messages

VOICE = ('V',)#

Voice messages (recorded on the website)

AUDIO = ('a',)#

Messages with an audio file

VIDEO = ('v',)#

Messages with a video file

IMAGE = ('i',)#

Messages with an image file

ATTACHMENT = ('A',)#

Messages with arbitrary file attachments

class ApprovalStatus#

Bases: django.db.models.IntegerChoices

Contains the situations a message can be in regarding approval.

Initialize self. See help(type(self)) for accurate signature.

NO = (0,)#
AUTOMATICALLY_APPROVED = (1,)#
APPROVED_BY_BOT_MANAGER = (2,)#
class SystemEvent#
CREATED = 'conversation-created'#
JOINED = 'participant-joined'#
LEFT = 'participant-left'#
ENDED = 'conversation-ended'#
class Meta#
verbose_name#
verbose_name_plural#
constraints#
m_id#
type#
conversation#
time#
quoted_message#
sender#
approval_status#
text#
additional_metadata#
original_file_name#
file_key#
file#
file_size#
mime_type#
external_file_url#
local_id#
command#
sent_by_manager#
__str__()#

Return str(self).

Return type:

str

save(force_insert=False, force_update=False, using=None, update_fields=None)#

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Parameters:
  • force_insert (bool) –

  • force_update (bool) –

  • using (Any) –

  • update_fields (Any | None) –

Return type:

Any | None

clean()#

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

Return type:

None

sent_by_human()#

Check if this message was sent by a person.

Returns:

True if and only if the message was sent by a human user

Return type:

bool

class MessageOption(*args, **kwargs)#

Bases: django.db.models.Model

Represents one of the options given to the user.

class Meta#
ordering = ['position']#
option_text#
position#
message#
__str__()#

Return str(self).

Return type:

str