###Djangoのsettingsが効いてる状態で対話式にAPIとかの動作確認をしたい
python manage.py shell
対話モードになります
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
Djangoのモデルや、ライブラリー等が、ソースに書く感覚で対話式に扱えます
>>> from links.models import Link
>>> from django.db.models import Q
>>> filter = (
... Q(url__icontains="code") | Q(description__icontains="code"))
>>> article = Link.objects.filter(filter)
>>> for e in article.all():
... print(e.description)
code writing keep me sane