Tips for django, python

python function argument
for example :
def func(input1, *input2, **input3)

*input2 > tuple
**input3 > dict

for concrete example:
def bucha(name, *things_have,**dudu):
print name
print things_have
print dudu

yh get result by call bucha('sirs','duma','dugu',damn='kin')
sirs
('duma','dugu')
{'damn':'kim'}

django models

Q > LIKE keyword
F > for compare model field with another field in that model

-> one to one -> models.OneToOneField()
-> many to many -> models.ManyToManyField()

Comments

Popular posts from this blog

Difference between apt-get update and apt-get dis-upgrade