python - Interpret the sql query in django view -


how write django view following statement in sql:

select * table arg1=value or arg2=value; 

you want "or" clause can implemented django's q objects:

from django.db.models import q mymodel.objects.filter(q(arg1=value) | q(arg2=value)) 

see https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -