# Django part 2- building the collections API- cannot post to /collections

**URL:** https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057
**Category:** Django
**Created:** [February 2, 2023, 5:21am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057 "2023-02-02T05:21:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Mrfinesse47](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Mrfinesse47](https://forum.codewithmosh.com/u/Mrfinesse47)
#### Post date: [February 2, 2023, 5:21am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057/1 "2023-02-02T05:21:03Z")

</div>

No matter what I do i cannot post to /collections  
it keeps on saying that the aggregate field products\_count is required.  
has anyone else been able to POST to /collections?

I get the error on POST:

{  
“products\_count”: [  
“This field is required.”  
]  
}

---

<div class="post-metadata">

### Author: ![tooTALLtim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/tootalltim/32/5469_2.png) [@tooTALLtim](https://forum.codewithmosh.com/u/tooTALLtim)
#### Post date: [February 3, 2023, 12:10am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057/2 "2023-02-03T00:10:33Z")

</div>

Did you make products\_count a read-only field in your serializer?

Here’s what I have:

```auto
class CollectionSerializer(serializers.ModelSerializer):
    class Meta:
        model = Collection
        fields = ['id', 'title', 'products_count']
    
    products_count = serializers.IntegerField(read_only=True)

```

---

<div class="post-metadata">

### Author: ![Mrfinesse47](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Mrfinesse47](https://forum.codewithmosh.com/u/Mrfinesse47)
#### Post date: [February 3, 2023, 1:48am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057/3 "2023-02-03T01:48:29Z")

</div>

no I didnt,

that was the issue, thanks

---

<div class="post-metadata">

### Author: ![tooTALLtim](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/tootalltim/32/5469_2.png) [@tooTALLtim](https://forum.codewithmosh.com/u/tooTALLtim)
#### Post date: [February 3, 2023, 2:39am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057/4 "2023-02-03T02:39:53Z")

</div>

For sure, cheers! 🔥 🔥

---

<div class="post-metadata">

### Author: ![mariselvam](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mariselvam](https://forum.codewithmosh.com/u/mariselvam)
#### Post date: [June 23, 2023, 6:25am UTC](https://forum.codewithmosh.com/t/django-part-2-building-the-collections-api-cannot-post-to-collections/18057/5 "2023-06-23T06:25:03Z")

</div>

I used like to avoid this error  
products\_count = serializers.IntegerField(required = False)
