Skip to content

Instantly share code, notes, and snippets.

@artieziff
Last active December 17, 2015 03:09
Show Gist options
  • Save artieziff/5541311 to your computer and use it in GitHub Desktop.
Save artieziff/5541311 to your computer and use it in GitHub Desktop.

###ORM COMMANDS DJANGO

python manage.py shell

from app.models import Class

Model.objects.all()

Model.objects.all()[1]

Model.objects.get(id=2)

Model.objects.filter(id=1)

Model.objects.filter(question__startswith='What')

Model.create(choice_text='Just hacking again', votes=0)

Model.objects.count()

p.save()

p.delete()

exit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment