- 運営しているクリエイター
記事一覧
25 VS Code Productivity
Command + p => type >: Enables to do many stuff from here
Command + p => type @: Finds a symbol, better than Cmd + f
Ctl + d: Choose same word
Opt + click: multi cursor
Opt. + arrow keys: moves li
DjangoアプリをDigitalOceanでUpdate
1. Open terminal on Mac
2.1.
ssh USERNAME(e.g. djangoadmin)@IP ADDRESS(111.11.111.11)
2.2. type exit to log out
2.3. If you can't log in, try
ssh-add ./.ssh/id_rsa_doIf no errors, below should
Django memo: models.py 選択肢
class Foodの上に、CATEOGRY = ()とすることで選択肢を作成
model内でCharField()の引数にchoices=CATEGORYを追加で完了。
これするのに何日かかったのやら
from django.db import modelsfrom django.contrib.auth.models import Userfrom django.core.validat
Django: 今日の日付のデータを取ってくる
いたってシンプル。
foods = modelname.objects.filter(カラム名=date.today)
.filter()がポイント
# views.pyfrom datetime import datedef foods(request):# point!!! foods = Food.objects.filter(eaten_date=date.today()) #合計