'create()' must be implemented
<p>I'm quite new to Django and I'm using Apache Cassandra as my database. There's this one error I have when sending a form using jquery ajax.</p>
<blockquote>
<p>NotImplementedError at /chatdata/</p>
<p><code>create()</code> must be implemented.</p>
</blockquote>
<p>Here's my serializers.py</p>
<pre><code>from rest_framework import serializers
from .models import Chat
import uuid
from django.utils import timezone

class ChatSerializer(serializers.Serializer):
    room_id = serializers.UUIDField()
    username = serializers.CharField()
    mac = serializers.CharField()
    message = serializers.CharField()
    created_at = serializers.UUIDField(default=uuid.uuid1())
    ts_created = serializers.DateTimeField(default=timezone.now())

    class Meta:
        fields = '__all__'
</code></pre>
<p>and here's my views.py</p>
<pre><code>from django.shortcuts import render

from django.views.decorators.csrf import csrf_exempt
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from .models import Chat, Bulletin
from .serializers import ChatSerializer, BulletinSerializer

class ChatList(APIView):

    @csrf_exempt
    def get(self, request):
        chats = Chat.objects(Chat.room_id == &quot;bbbcb63c-027e-427b-a6e5-b575a79de797&quot;).order_by(&quot;-created_at&quot;)
        serializer = ChatSerializer(chats, many=True)
        return Response(serializer.data)

    @csrf_exempt
    def post(self, request):
        serializer = ChatSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
</code></pre>
<p>lastly, my jquery to send the form:</p>
<pre><code>$(document).ready(function () {
    $('#formchat').on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            url : $(this).attr('action') || window.location.pathname,
            type: &quot;POST&quot;,
            header: {
                'Access-Control-Allow-Origin': '*'
            },
            data: $(this).serialize(),
            dataType: 'json',
            success: function (data) {
                $(&quot;#chatinput&quot;).val('');
            },
            error: function (jXHR, textStatus, errorThrown) {
                alert(errorThrown);
            }
        });
    });
});
</code></pre>
<p><strong>Update:</strong>
here's my models.py</p>
<pre><code>import uuid
from django.utils import timezone
from cassandra.cqlengine import columns
from django_cassandra_engine.models import DjangoCassandraModel

class Chat(DjangoCassandraModel):
    room_id = columns.UUID(partition_key=True, default=uuid.uuid4())
    username = columns.Text(required=True)
    mac = columns.Text(min_length=17, max_length=17, required=True)
    message = columns.Text(required=True)
    created_at = columns.UUID(primary_key=True, default=uuid.uuid1(), required=True, clustering_order=&quot;DESC&quot;)
    ts_created = columns.DateTime(default=timezone.now())

    class Meta:
        get_pk_field = 'room_id'
</code></pre>