Answer the question
In order to leave comments, you need to log in
What is this construct: shop, _ = Shop.objects.get.... blah blah blah....?
In the online store project on django, I saw the following construction:
shop, _ = Shop.objects.get_or_create(name=data['shop'], user_id=request.user.id)
shop, _ =
Answer the question
In order to leave comments, you need to log in
Most likely, the get_or_create method returns an array (tuple) with two values, where the first element is written to the shop variable, and the second is simply not needed, so it is simply ignored with
_UPD. Here is what I found in the documentation: https://djbook.ru/rel1.7/ref/models/querysets.html...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question