These are chat archives for django/django

9th
Feb 2016
kdelinx
@kdelinx
Feb 09 2016 07:04
Hi! i'm stupid today ;) I have a query - cart, cart_state = Cart.objects.get_or_create(user=user). How I can get ONLY 1 instace, if in db i have more than one, slice dont work
Ikhsan Noor Rosyidin
@essanpupil
Feb 09 2016 08:47
@kdelinx from here, https://docs.djangoproject.com/en/1.9/ref/models/querysets/#get-or-create you can not get multiple objects. If you have multiple user for one Cart object, maybe you can use filter in queryset.
kdelinx
@kdelinx
Feb 09 2016 08:57
@essanpupil Thanks, i solved my questions!