# Path: banking/accounts/models.py
# class Account(models.Model):
#     name = models.CharField(max_length=50)
#     balance = models.DecimalField(max_digits=65, decimal_places=2)
#     slug = models.SlugField(unique=True)
# 
#     def __str__(self):
#         return self.slug
# 
# Path: banking/accounts/forms.py
# class TransferForm(forms.Form):
#     date = forms.DateField( widget=forms.TextInput(attrs={'class': 'ink-datepicker', 'data-start-week-day': "0", 'size': '10'}))
#     from_acct = TransferChoiceField(queryset=Account.objects.all())
#     to_acct = TransferChoiceField(queryset=Account.objects.all())
#     amount = forms.DecimalField(max_digits=65, decimal_places=2, localize=True,  widget=forms.TextInput(attrs={'size': '6'}))


from django.shortcuts import render
from django.views.generic import View, CreateView, UpdateView
from django.db.models import Sum
from .models import Account
from .forms import TransferForm
from transactions.forms import FilterForm
from transactions.models import Transaction, Category
from budget.models import Budget
import datetime


class AccountsOverview(View):

    def get_context(self, *args, **kwargs):
        transfer_form = TransferForm(prefix='transfer_form')
        filter_form = FilterForm(prefix='filter_form')

# Path: banking/accounts/models.py
# class Account(models.Model):
#     name = models.CharField(max_length=50)
#     balance = models.DecimalField(max_digits=65, decimal_places=2)
#     slug = models.SlugField(unique=True)
# 
#     def __str__(self):
#         return self.slug
# 
# Path: banking/accounts/forms.py
# class TransferForm(forms.Form):
#     date = forms.DateField( widget=forms.TextInput(attrs={'class': 'ink-datepicker', 'data-start-week-day': "0", 'size': '10'}))
#     from_acct = TransferChoiceField(queryset=Account.objects.all())
#     to_acct = TransferChoiceField(queryset=Account.objects.all())
#     amount = forms.DecimalField(max_digits=65, decimal_places=2, localize=True,  widget=forms.TextInput(attrs={'size': '6'}))


# Path: banking/accounts/views.py
from django.shortcuts import render
from django.views.generic import View, CreateView, UpdateView
from django.db.models import Sum
from .models import Account
from .forms import TransferForm
from transactions.forms import FilterForm
from transactions.models import Transaction, Category
from budget.models import Budget
import datetime



class AccountsOverview(View):

    def get_context(self, *args, **kwargs):
        transfer_form = TransferForm(prefix='transfer_form')
        filter_form = FilterForm(prefix='filter_form')

        accounts = Account.objects.all().order_by('name')