Stonks/overview/views.py

18 lines
516 B
Python

from django.http import HttpResponse
from django.shortcuts import render
from .models import Account, AccountHolding
# Create your views here.
def index(request):
accounts = Account.objects.all()
return render(request, "overviewbase.html", {"accounts": accounts})
def portfolio(request, account_id):
account = Account.objects.get(pk=account_id)
holdings = AccountHolding.objects.filter(account = account)
return render(request, "portfolio.html", {"account": account, "holdings": holdings})