# Model of cart for online shop

**URL:** <https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642>\
**Category:** Using Django\
**Created:** [January 17, 2022, 2:54pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642 "2022-01-17T14:54:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeonardoBigShot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leonardobigshot/32/7061_2.png) [@LeonardoBigShot](https://forum.djangoproject.com/u/LeonardoBigShot)\
**Post date:** [January 17, 2022, 2:54pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642/1 "2022-01-17T14:54:28Z")

</div>

Hello, I’m coding backend for online-shop. But in my project some problems. When I’m trying to save cart by session in db it doesn’t happens. When I’m trying to write:

PS C:\Users\user\Desktop\django\_shop\> python manage.py migrate  
Operations to perform:  
Apply all migrations: admin, auth, contenttypes, sessions, shop  
Running migrations:  
No migrations to apply.  
PS C:\Users\user\Desktop\django\_shop\> python manage.py makemigrations  
No changes detected

But model of my cart doesn’t work, how can I fix this?

---

<div class="post-metadata">

**Author:** ![LeonardoBigShot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leonardobigshot/32/7061_2.png) [@LeonardoBigShot](https://forum.djangoproject.com/u/LeonardoBigShot)\
**Post date:** [January 17, 2022, 2:56pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642/2 "2022-01-17T14:56:58Z")

</div>

Here is a code of my site:

> **[GitHub - LeonardoBigShot/django-shop](https://github.com/LeonardoBigShot/django-shop)**
>
> Contribute to LeonardoBigShot/django-shop development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [January 17, 2022, 3:56pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642/3 "2022-01-17T15:56:15Z")

</div>

@LeonardoBigShot you don’t have a Cart Model you have a Cart Class that is not a instance of django.models.Model, so you can’t migrate that.

---

<div class="post-metadata">

**Author:** ![LeonardoBigShot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leonardobigshot/32/7061_2.png) [@LeonardoBigShot](https://forum.djangoproject.com/u/LeonardoBigShot)\
**Post date:** [January 17, 2022, 4:53pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642/4 "2022-01-17T16:53:02Z")

</div>

Okey, what should I do to add cart of users in database?

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [January 17, 2022, 5:17pm UTC](https://forum.djangoproject.com/t/model-of-cart-for-online-shop/11642/5 "2022-01-17T17:17:18Z")

</div>

You should create a Django Model, I encourage you to follow the next tutorials, after them you could understand better what are you doing:

[https://docs.djangoproject.com/en/4.0/intro/tutorial01/](https://docs.djangoproject.com/en/4.0/intro/tutorial01/)

> **[Django Tutorial: The Local Library website - Learn web development | MDN](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Tutorial_local_library_website)**
>
> Now that you know a bit more about the LocalLibrary website and what you're going to learn, it's time to start creating a skeleton project to contain our example.
