# Stuck on Creating a cart

**URL:** <https://forum.codewithmosh.com/t/stuck-on-creating-a-cart/22627>\
**Category:** Python\
**Created:** [September 20, 2023, 2:08pm UTC](https://forum.codewithmosh.com/t/stuck-on-creating-a-cart/22627 "2023-09-20T14:08:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pisicuta](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@Pisicuta](https://forum.codewithmosh.com/u/Pisicuta)\
**Post date:** [September 20, 2023, 2:08pm UTC](https://forum.codewithmosh.com/t/stuck-on-creating-a-cart/22627/1 "2023-09-20T14:08:36Z")

</div>

I am using the Ultimate Django course. I am up to part 2 Designing and Implementing a Shopping Cart API. It must be me because other people have done it, but I can’t see what is wrong. Thereare only three things to do according to Mosh: Create a View, Create a Serializer and Create a Route. Three simple steps I have done too many times now with the same result. When I Post to create the empty Cart I am greeted with  
`create()` must be implemented.

| Request Method: | POST |
| --- | --- |
| Request URL: | [http://127.0.0.1:8000/store/carts/](http://127.0.0.1:8000/store/carts/) |
| Django Version: | 4.2.5 |
| Exception Type: | NotImplementedError |
| Exception Value: | `create()` must be implemented. |

Which I thought was covered by  
class CartViewSet(CreateModelMixin, GenericViewSet):  
queryset = Cart.objects.all()  
serializer\_class = CartSerializer

What have I missed?

For completeness  
URL  
router.register(‘carts’, views.CartViewSet)  
Serializer  
class CartSerializer(serializers.Serializer):

```
id = serializers.UUIDField(read_only=True)

class Meta:
    model = Cart
    fields = ['id']

```

---

<div class="post-metadata">

**Author:** ![Pisicuta](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@Pisicuta](https://forum.codewithmosh.com/u/Pisicuta)\
**Post date:** [September 21, 2023, 9:45am UTC](https://forum.codewithmosh.com/t/stuck-on-creating-a-cart/22627/2 "2023-09-21T09:45:11Z")

</div>

> [@Pisicuta](#):
>
> class CartSerializer(serializers.Serializer):

It’s me doing it wrong again. Should be  
class CartSerializer(serializers.ModelSerializer):  
…
