from django.db import models


class Channel(models.Model):
    def __str__(self):
        return self.name

    name = models.CharField(max_length=20, unique=True)


class Message(models.Model):
    def __str__(self):
        return self.text

    def to_dict(self):
        serializable_fields = ('text', 'datetime_start', 'datetime_sent', 'username')
        return {key: getattr(self, key) for key in serializable_fields}

    text = models.TextField(max_length=2000)
    datetime_start = models.DateTimeField(default=None)
    datetime_sent = models.DateTimeField(default=None, null=True)
    typing = models.BooleanField(default=False)
    username = models.CharField(max_length=20)
    channel = models.ForeignKey(Channel)

@@ -420,16 +420,133 @@
 ields%7D%0A%0A
+    TEXT = 'text'%0A    IMAGE = 'image'%0A%0A    MESSAGE_TYPE = (%0A        (TEXT, 'text'),%0A        (IMAGE, 'image'),%0A    )%0A%0A
     text
@@ -840,8 +840,167 @@
 hannel)%0A
+    message_type = models.CharField(max_length=10,%0A                                    choices=MESSAGE_TYPE,%0A                                    default=TEXT)%0A

Add message_type field into message model