DEV Community

Matt Dyor
Matt Dyor

Posted on • Updated on

Things I Learned About Python this Week


python manage.py shell

this gets you into an interactive shell

from basic_loans.models import BasicLoan DOES NOT WORK
from dyor_com_app.basic_loans.models import BasicLoanPage
b=BasicLoanPage
from dyor_com_app.base.models import People
p = People
p.first="matt"
p.last="dyor"
bl1 = BasicLoan.objects.filter(id=1).first()

which is the same as:

bl1 = BasicLoan.objects.get(id=1)
bl1.loan_amount

create a record

BL = BasicLoan()
BL.loan_amount
BL.original = bl1

import datetime

BL.loan_start_date = datetime.date(2021, 11, 25)
BL.save()

Discussion (0)