basic python with Django -


i'm reading of django docs , i've come across

    obj, created = person.objects.get_or_create(first_name='john', last_name='lennon',               defaults={'birthday': date(1940, 10, 9)}) 

i'm still learning python in process. i'm bit confused "obj, created = " part of code. assume both "obj" , "created" perform

    person.objects.get_or_create(first_name='john', last_name='lennon',               defaults={'birthday': date(1940, 10, 9)}) 

person.objects.get_or_create returns 2 values, assigned obj , created respectively. obj actual object gotten or created, , created flag tells if created (or gotten).


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -