Answers for ""get_or_create" takes 1 positional argument but 2 were given"

0

"get_or_create" takes 1 positional argument but 2 were given

# Make sure to specify the kwargs

# Instead of
MyModel.objects.get_or_create(attr)  # WRONG!

# Use
MyModel.objects.get_or_create(attr=attr)  # CORRECT!
Posted by: Guest on August-04-2021

Code answers related to ""get_or_create" takes 1 positional argument but 2 were given"

Python Answers by Framework

Browse Popular Code Answers by Language