from django . db import models from brand . models import Brand from whatsapp . models import Contact class Chat ( models . Model ): MESSAGE_TYPES = [ ( 'text' , 'Text' ), ( 'image' , 'Image' ), ( 'video' , 'Video' ), ( 'document' , 'Document' ), ( 'button' , 'Button' ), ( 'interactive' , 'Interactive' ), ] brand = models . ForeignKey ( Brand , on_delete = models . CASCADE , related_name = 'chats' ) contact = models . ForeignKey ( Contact , on_delete = models . CASCADE , related_name = 'chats' ) message_id = models . CharField ( max_length = 256 , unique = True , db_index = True ) # WhatsApp message ID timestamp = models . DateTimeField () # Message timestamp message_type = models . CharField ( max_length = 20 , choices = MESSAGE_TYPES ) # Message type content = models . ...
Comments
Post a Comment