0
order_item, created = OrderItem.objects.get_or_create(
    item=item,
    user = request.user,
    ordered = False
)

now here I can't understand how it will work I tried searching the web but had no luck :(

accdias
  • 4,552
  • 3
  • 18
  • 30
Aneeq Ak
  • 51
  • 9
  • What is your exact question here.. – Sumithran May 13 '21 at 14:04
  • @Sumithran bro i cant understand how "order_item, created = .... " works like when to use created and when to user order_item – Aneeq Ak May 13 '21 at 14:06
  • 2
    Does this answer your question? [Python assigning multiple variables to same value? list behavior](https://stackoverflow.com/questions/16348815/python-assigning-multiple-variables-to-same-value-list-behavior) – Tom McLean May 13 '21 at 14:06
  • @TomMcLean I dont think so because here is only one source but two variable or multiple variable – Aneeq Ak May 13 '21 at 14:08
  • 2
    @AneeqAk that one source is returning multiple values – MattDMo May 13 '21 at 14:09
  • 1
    @AneeqAk unlike other languages, python can have functions that return multiple values and can then be set to multiple variables, read about them here - https://note.nkmk.me/en/python-multi-variables-values/ – Tom McLean May 13 '21 at 14:13

0 Answers0