Kevin Veroneau avatar Kevin Veroneau committed fffb63b

Initial commit of personal apps to bitbucket. GPL2 license.

Comments (0)

Files changed (94)

Empty file added.

+from django.contrib.syndication.views import Feed
+from pcbank.models import Bank, CreditCard
+
+class BankingBookmarks(Feed):
+    title = 'Online banking'
+    link = "/pcbank/"
+    description = "Online banking links RSS Feed"
+    def items(self):
+        bank_list = Bank.objects.filter(active=True)
+        cc_list = CreditCard.objects.filter(active=True)
+        names = []
+        for bank in bank_list:
+            names.append(bank.title)
+        for cc in cc_list:
+            names.append(cc.title)
+        return names
+    
+    def item_link(self, item):
+        try:
+            obj = Bank.objects.get(title=item)
+        except Bank.DoesNotExist:
+            obj = CreditCard.objects.get(title=item)
+        return obj.url
+from django import forms
+from pcbank.models import Bill, Cheque
+
+class NewBillForm(forms.ModelForm):
+    class Meta:
+        model = Bill
+        fields = ('amount',)
+
+class NewChequeForm(forms.ModelForm):
+    class Meta:
+        model = Cheque
+        exclude = ('transaction',)

pcbank/migrations/0001_initial.py

+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Transaction'
+        db.create_table('pcbank_transaction', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('from_ct', self.gf('django.db.models.fields.related.ForeignKey')(related_name='fromtrans_set', to=orm['contenttypes.ContentType'])),
+            ('from_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('memo', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
+            ('date', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
+            ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
+        ))
+        db.send_create_signal('pcbank', ['Transaction'])
+
+        # Adding model 'Income'
+        db.create_table('pcbank_income', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=80)),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('per_month', self.gf('django.db.models.fields.IntegerField')()),
+            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+        ))
+        db.send_create_signal('pcbank', ['Income'])
+
+        # Adding model 'CreditCard'
+        db.create_table('pcbank_creditcard', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=80)),
+            ('credit', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('balance', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('min_payment', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('due_date', self.gf('django.db.models.fields.DateField')()),
+            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+            ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
+        ))
+        db.send_create_signal('pcbank', ['CreditCard'])
+
+        # Adding model 'Payee'
+        db.create_table('pcbank_payee', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=80)),
+            ('account', self.gf('django.db.models.fields.CharField')(max_length=40)),
+            ('split_by', self.gf('django.db.models.fields.IntegerField')()),
+            ('due_date', self.gf('django.db.models.fields.DateField')()),
+            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+        ))
+        db.send_create_signal('pcbank', ['Payee'])
+
+        # Adding model 'Bill'
+        db.create_table('pcbank_bill', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('payee', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pcbank.Payee'])),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=5, decimal_places=2)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+            ('paid', self.gf('django.db.models.fields.BooleanField')(default=False)),
+        ))
+        db.send_create_signal('pcbank', ['Bill'])
+
+        # Adding model 'Bank'
+        db.create_table('pcbank_bank', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=80)),
+            ('card', self.gf('django.db.models.fields.CharField')(max_length=40)),
+            ('balance', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
+        ))
+        db.send_create_signal('pcbank', ['Bank'])
+
+        # Adding model 'Roommate'
+        db.create_table('pcbank_roommate', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=20)),
+            ('total_given', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('added_on', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
+            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
+        ))
+        db.send_create_signal('pcbank', ['Roommate'])
+
+        # Adding model 'RoommateBill'
+        db.create_table('pcbank_roommatebill', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('roommate', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pcbank.Roommate'])),
+            ('for_bill', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pcbank.Bill'])),
+            ('paid', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('pay_date', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
+        ))
+        db.send_create_signal('pcbank', ['RoommateBill'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Transaction'
+        db.delete_table('pcbank_transaction')
+
+        # Deleting model 'Income'
+        db.delete_table('pcbank_income')
+
+        # Deleting model 'CreditCard'
+        db.delete_table('pcbank_creditcard')
+
+        # Deleting model 'Payee'
+        db.delete_table('pcbank_payee')
+
+        # Deleting model 'Bill'
+        db.delete_table('pcbank_bill')
+
+        # Deleting model 'Bank'
+        db.delete_table('pcbank_bank')
+
+        # Deleting model 'Roommate'
+        db.delete_table('pcbank_roommate')
+
+        # Deleting model 'RoommateBill'
+        db.delete_table('pcbank_roommatebill')
+
+
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'pcbank.bank': {
+            'Meta': {'object_name': 'Bank'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'card': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.bill': {
+            'Meta': {'object_name': 'Bill'},
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'payee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Payee']"})
+        },
+        'pcbank.creditcard': {
+            'Meta': {'object_name': 'CreditCard'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'credit': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'min_payment': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.income': {
+            'Meta': {'object_name': 'Income'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'per_month': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
+        },
+        'pcbank.payee': {
+            'Meta': {'ordering': "['due_date']", 'object_name': 'Payee'},
+            'account': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'split_by': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
+        },
+        'pcbank.roommate': {
+            'Meta': {'object_name': 'Roommate'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'total_given': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'})
+        },
+        'pcbank.roommatebill': {
+            'Meta': {'object_name': 'RoommateBill'},
+            'for_bill': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Bill']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'pay_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'roommate': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Roommate']"})
+        },
+        'pcbank.transaction': {
+            'Meta': {'ordering': "['-date']", 'object_name': 'Transaction'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'from_ct': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fromtrans_set'", 'to': "orm['contenttypes.ContentType']"}),
+            'from_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'memo': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {})
+        }
+    }
+
+    complete_apps = ['pcbank']

pcbank/migrations/0002_auto__add_field_payee_url.py

+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Payee.url'
+        db.add_column('pcbank_payee', 'url',
+                      self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Payee.url'
+        db.delete_column('pcbank_payee', 'url')
+
+
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'pcbank.bank': {
+            'Meta': {'object_name': 'Bank'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'card': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.bill': {
+            'Meta': {'object_name': 'Bill'},
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'payee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Payee']"})
+        },
+        'pcbank.creditcard': {
+            'Meta': {'object_name': 'CreditCard'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'credit': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'min_payment': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.income': {
+            'Meta': {'object_name': 'Income'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'per_month': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
+        },
+        'pcbank.payee': {
+            'Meta': {'ordering': "['due_date']", 'object_name': 'Payee'},
+            'account': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'split_by': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+        },
+        'pcbank.roommate': {
+            'Meta': {'object_name': 'Roommate'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'total_given': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'})
+        },
+        'pcbank.roommatebill': {
+            'Meta': {'object_name': 'RoommateBill'},
+            'for_bill': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Bill']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'pay_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'roommate': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Roommate']"})
+        },
+        'pcbank.transaction': {
+            'Meta': {'ordering': "['-date']", 'object_name': 'Transaction'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'from_ct': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fromtrans_set'", 'to': "orm['contenttypes.ContentType']"}),
+            'from_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'memo': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {})
+        }
+    }
+
+    complete_apps = ['pcbank']

pcbank/migrations/0003_auto__add_cheque.py

+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Cheque'
+        db.create_table('pcbank_cheque', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('number', self.gf('django.db.models.fields.PositiveIntegerField')()),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=6, decimal_places=2)),
+            ('transaction', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pcbank.Transaction'], null=True, blank=True)),
+            ('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
+            ('memo', self.gf('django.db.models.fields.TextField')()),
+            ('post_date', self.gf('django.db.models.fields.DateField')()),
+        ))
+        db.send_create_signal('pcbank', ['Cheque'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Cheque'
+        db.delete_table('pcbank_cheque')
+
+
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'pcbank.bank': {
+            'Meta': {'object_name': 'Bank'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'card': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.bill': {
+            'Meta': {'object_name': 'Bill'},
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'payee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Payee']"})
+        },
+        'pcbank.cheque': {
+            'Meta': {'object_name': 'Cheque'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'memo': ('django.db.models.fields.TextField', [], {}),
+            'number': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'post_date': ('django.db.models.fields.DateField', [], {}),
+            'transaction': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Transaction']", 'null': 'True', 'blank': 'True'})
+        },
+        'pcbank.creditcard': {
+            'Meta': {'object_name': 'CreditCard'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'balance': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'credit': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'min_payment': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'pcbank.income': {
+            'Meta': {'object_name': 'Income'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'per_month': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
+        },
+        'pcbank.payee': {
+            'Meta': {'ordering': "['due_date']", 'object_name': 'Payee'},
+            'account': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'due_date': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'split_by': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+        },
+        'pcbank.roommate': {
+            'Meta': {'object_name': 'Roommate'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'total_given': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'})
+        },
+        'pcbank.roommatebill': {
+            'Meta': {'object_name': 'RoommateBill'},
+            'for_bill': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Bill']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'paid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'pay_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'roommate': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['pcbank.Roommate']"})
+        },
+        'pcbank.transaction': {
+            'Meta': {'ordering': "['-date']", 'object_name': 'Transaction'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '6', 'decimal_places': '2'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'from_ct': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fromtrans_set'", 'to': "orm['contenttypes.ContentType']"}),
+            'from_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'memo': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {})
+        }
+    }
+
+    complete_apps = ['pcbank']
Add a comment to this file

pcbank/migrations/__init__.py

Empty file added.

+# -*- coding: utf-8 -*-
+from django.db import models
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.contenttypes import generic
+import datetime
+
+class Transaction(models.Model):
+    from_ct = models.ForeignKey(ContentType, related_name='fromtrans_set')
+    from_id = models.PositiveIntegerField()
+    from_obj = generic.GenericForeignKey('from_ct', 'from_id')
+    amount = models.DecimalField(max_digits=6, decimal_places=2)
+    memo = models.CharField(max_length=60, blank=True, null=True)
+    date = models.DateField(auto_now_add=True)
+    content_type = models.ForeignKey(ContentType)
+    object_id = models.PositiveIntegerField()
+    content_object = generic.GenericForeignKey()
+    class Meta:
+        ordering = ['-date']
+    def __unicode__(self):
+        return "%s to %s of %d" % (self.from_obj, self.content_object, self.amount)
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-transaction', [str(self.pk)])
+
+class Income(models.Model):
+    title = models.CharField(max_length=80)
+    amount = models.DecimalField(max_digits=6, decimal_places=2)
+    per_month = models.IntegerField()
+    active = models.BooleanField()
+    added_on = models.DateField(auto_now_add=True)
+    transactions = generic.GenericRelation(Transaction, content_type_field='from_ct', object_id_field='from_id')
+    def __unicode__(self):
+        return u"%s - $%d" % (self.title, self.amount)
+    def monthly_amount(self):
+        return self.amount * self.per_month
+    def yearly_amount(self):
+        return self.monthly_amount() * 12
+    @models.permalink
+    def payday(self):
+        return ('pcbank.views.payday', [str(self.pk)])
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-income', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-income', [str(self.pk)])
+
+class CreditCard(models.Model):
+    title = models.CharField(max_length=80)
+    credit = models.DecimalField(max_digits=6, decimal_places=2)
+    balance = models.DecimalField(max_digits=6, decimal_places=2)
+    min_payment = models.DecimalField(max_digits=6, decimal_places=2)
+    due_date = models.DateField()
+    active = models.BooleanField()
+    added_on = models.DateField(auto_now_add=True)
+    url = models.URLField('Online Banking site', verify_exists=False)
+    transactions = generic.GenericRelation(Transaction, content_type_field='from_ct', object_id_field='from_id')
+    def __unicode__(self):
+        return u"%s - $%d" % (self.title, self.balance)
+    def available_credit(self):
+        return self.credit - self.balance
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-cc', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-cc', [str(self.pk)])
+
+class Payee(models.Model):
+    title = models.CharField(max_length=80)
+    account = models.CharField('Account #', max_length=40)
+    split_by = models.IntegerField('Split by how many people')
+    due_date = models.DateField()
+    active = models.BooleanField()
+    added_on = models.DateField(auto_now_add=True)
+    url = models.URLField('Account site', verify_exists=False, blank=True, null=True)
+    transactions = generic.GenericRelation(Transaction)
+    class Meta:
+        ordering = ['due_date']
+    def __unicode__(self):
+        return u"%s" % self.title
+    @models.permalink
+    def add_bill(self):
+        return ('pcbank.views.add_bill', [str(self.pk)])
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-payee', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-payee', [str(self.pk)])
+
+class Bill(models.Model):
+    payee = models.ForeignKey(Payee)
+    amount = models.DecimalField(max_digits=5, decimal_places=2)
+    added_on = models.DateField(auto_now_add=True)
+    paid = models.BooleanField()
+    def __unicode__(self):
+        return u"%s - $%s" % (self.payee.title, self.amount)
+    def split_amount(self):
+        return self.amount / self.payee.split_by
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-bill', [str(self.pk)])
+    @models.permalink
+    def mark_paid(self):
+        return ('pcbank.views.mark_paid', [str(self.pk)])
+    @models.permalink
+    def bank_payment(self):
+        return ('pcbank.views.make_bank_payment', [str(self.pk)])
+    @models.permalink
+    def cc_payment(self):
+        return ('pcbank.views.make_cc_payment', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-bill', [str(self.pk)])
+
+class Bank(models.Model):
+    title = models.CharField(max_length=80)
+    card = models.CharField('Card Number', max_length=40)
+    balance = models.DecimalField(max_digits=6, decimal_places=2)
+    added_on = models.DateField(auto_now_add=True)
+    active = models.BooleanField()
+    url = models.URLField('Online Banking site', verify_exists=False)
+    transactions = generic.GenericRelation(Transaction, content_type_field='from_ct', object_id_field='from_id')
+    income = generic.GenericRelation(Transaction, related_name='incomes')
+    def __unicode__(self):
+        return u"%s - $%s" % (self.title, self.balance)
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-bank', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-bank', [str(self.pk)])
+
+class Roommate(models.Model):
+    name = models.CharField(max_length=20)
+    total_given = models.DecimalField(max_digits=6, decimal_places=2)
+    added_on = models.DateField(auto_now_add=True)
+    active = models.BooleanField()
+    transactions = generic.GenericRelation(Transaction, content_type_field='from_ct', object_id_field='from_id')
+    def __unicode__(self):
+        return u"%s" % self.name
+    @models.permalink
+    def get_edit_url(self):
+        return ('edit-roommate', [str(self.pk)])
+    @models.permalink
+    def add_bill(self):
+        return ('pcbank.views.add_roommatebill', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-roommate', [str(self.pk)])
+
+class RoommateBill(models.Model):
+    roommate = models.ForeignKey(Roommate)
+    for_bill = models.ForeignKey(Bill)
+    paid = models.BooleanField()
+    pay_date = models.DateField(blank=True, null=True)
+    def __unicode__(self):
+        return u"%s" % self.for_bill.payee
+    def amount(self):
+        return self.for_bill.amount / self.for_bill.payee.split_by
+    def past_due(self):
+        if self.pay_date != None:
+            if self.pay_date > self.for_bill.payee.due_date:
+                return True
+            elif datetime.date.today() > self.for_bill.payee.due_date:
+                return True
+        return False
+    @models.permalink
+    def make_payment(self):
+        return ('pcbank.views.roommate_payment', [str(self.pk)])
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-roommatebill', [str(self.pk)])
+
+class Cheque(models.Model):
+    number = models.PositiveIntegerField()
+    amount = models.DecimalField(max_digits=6, decimal_places=2)
+    transaction = models.ForeignKey(Transaction, blank=True, null=True)
+    image = models.ImageField(upload_to='cheques', blank=True, null=True)
+    memo = models.TextField()
+    post_date = models.DateField()
+    def __unicode__(self):
+        return "Cheque #%s" % self.number
+    @models.permalink
+    def get_absolute_url(self):
+        return ('view-cheque', [str(self.number)])

pcbank/svnlog.txt

+------------------------------------------------------------------------
+r95 | kveroneau | 2013-03-18 13:17:31 -0500 (Mon, 18 Mar 2013) | 1 line
+
+Added Cheque Book to pcbank.
+------------------------------------------------------------------------
+r86 | kveroneau | 2012-10-13 12:07:49 -0500 (Sat, 13 Oct 2012) | 1 line
+
+Upgraded myapps to use Django 1.3.
+------------------------------------------------------------------------
+r69 | kveroneau | 2012-07-28 13:59:49 -0500 (Sat, 28 Jul 2012) | 1 line
+
+Fixed a divide by zero bug in monthly budget.
+------------------------------------------------------------------------
+r68 | kveroneau | 2012-07-26 19:56:59 -0500 (Thu, 26 Jul 2012) | 1 line
+
+Added next month link in Monthly budget.
+------------------------------------------------------------------------
+r67 | kveroneau | 2012-07-26 19:46:05 -0500 (Thu, 26 Jul 2012) | 1 line
+
+Updated the monthly budget to display the current month and year.
+------------------------------------------------------------------------
+r66 | kveroneau | 2012-07-26 19:41:20 -0500 (Thu, 26 Jul 2012) | 1 line
+
+Updated monthly budget to only display bills and credit cards due for the same month being viewed.  Also made bills clickable.
+------------------------------------------------------------------------
+r64 | kveroneau | 2012-07-22 23:32:25 -0500 (Sun, 22 Jul 2012) | 1 line
+
+Added account URL link to Payee list.
+------------------------------------------------------------------------
+r63 | kveroneau | 2012-07-22 23:24:05 -0500 (Sun, 22 Jul 2012) | 1 line
+
+Added accounts website link to Payee model.
+------------------------------------------------------------------------
+r62 | kveroneau | 2012-07-22 23:08:03 -0500 (Sun, 22 Jul 2012) | 1 line
+
+Converted PCBank to south.
+------------------------------------------------------------------------
+r61 | kveroneau | 2012-07-17 22:13:30 -0500 (Tue, 17 Jul 2012) | 1 line
+
+Updated pcbank templates to use bootstrap theme.
+------------------------------------------------------------------------
+r58 | kveroneau | 2012-07-16 02:27:39 -0500 (Mon, 16 Jul 2012) | 1 line
+
+SiteTracker is basically completed, final testing needs to be performed before deployment.
+------------------------------------------------------------------------
+r52 | kveroneau | 2012-07-11 17:28:00 -0500 (Wed, 11 Jul 2012) | 1 line
+
+Added svn:ignore to project for pyc files.
+------------------------------------------------------------------------
+r49 | kveroneau | 2012-06-22 08:27:19 -0500 (Fri, 22 Jun 2012) | 1 line
+
+Changed to use simplejson from Django.
+------------------------------------------------------------------------
+r48 | kveroneau | 2012-06-22 08:22:47 -0500 (Fri, 22 Jun 2012) | 1 line
+
+Created a JSON service for pcbank to be used on my phone.
+------------------------------------------------------------------------
+r46 | kveroneau | 2012-06-02 10:51:05 -0500 (Sat, 02 Jun 2012) | 1 line
+
+Added Monthly Budget.
+------------------------------------------------------------------------
+r45 | kveroneau | 2012-06-02 09:43:43 -0500 (Sat, 02 Jun 2012) | 2 lines
+
+Added Pagination in Transaction list.
+Added Bank Transfers.
+------------------------------------------------------------------------
+r42 | kveroneau | 2012-04-08 15:06:40 -0500 (Sun, 08 Apr 2012) | 1 line
+
+Updated pcbank's bill payments to increment the month of the payee's due date.
+------------------------------------------------------------------------
+r35 | kveroneau | 2012-01-14 04:33:51 -0600 (Sat, 14 Jan 2012) | 1 line
+
+Roommates which are not active will not display.
+------------------------------------------------------------------------
+r30 | kveroneau | 2011-11-10 11:30:52 -0600 (Thu, 10 Nov 2011) | 1 line
+
+Enabled support for Django Auth.
+------------------------------------------------------------------------
+r23 | kveroneau | 2011-10-26 09:11:36 -0500 (Wed, 26 Oct 2011) | 1 line
+
+Updates transaction lists in all templates to have clickable links.
+------------------------------------------------------------------------
+r22 | kveroneau | 2011-10-18 11:34:59 -0500 (Tue, 18 Oct 2011) | 1 line
+
+Payees now sort by their due dates.
+------------------------------------------------------------------------
+r21 | kveroneau | 2011-10-18 11:16:46 -0500 (Tue, 18 Oct 2011) | 1 line
+
+Corrected roommates total given.
+------------------------------------------------------------------------
+r20 | kveroneau | 2011-10-13 11:29:44 -0500 (Thu, 13 Oct 2011) | 1 line
+
+Added roommates owning to overview.
+------------------------------------------------------------------------
+r19 | kveroneau | 2011-10-13 11:19:38 -0500 (Thu, 13 Oct 2011) | 1 line
+
+Roommate manager added.
+------------------------------------------------------------------------
+r18 | kveroneau | 2011-10-12 08:59:11 -0500 (Wed, 12 Oct 2011) | 1 line
+
+Added transaction history to income and bill payments.
+------------------------------------------------------------------------
+r17 | kveroneau | 2011-10-09 04:27:35 -0500 (Sun, 09 Oct 2011) | 1 line
+
+Added available funds to PC Bank overview.
+------------------------------------------------------------------------
+r16 | kveroneau | 2011-10-06 21:32:34 -0500 (Thu, 06 Oct 2011) | 1 line
+
+Added template tags for bank and cc dropdowns, updated the Overview page.
+------------------------------------------------------------------------
+r15 | kveroneau | 2011-10-05 09:11:55 -0500 (Wed, 05 Oct 2011) | 1 line
+
+Secured insecure views.
+------------------------------------------------------------------------
+r14 | kveroneau | 2011-10-05 09:06:35 -0500 (Wed, 05 Oct 2011) | 1 line
+
+Forgot to add new files to last commit.
+------------------------------------------------------------------------
+r13 | kveroneau | 2011-10-05 09:05:28 -0500 (Wed, 05 Oct 2011) | 1 line
+
+Finished PC Banking App.
+------------------------------------------------------------------------
+r12 | kveroneau | 2011-10-04 23:02:53 -0500 (Tue, 04 Oct 2011) | 1 line
+
+Removed backup files for pcbank templates.
+------------------------------------------------------------------------
+r11 | kveroneau | 2011-10-04 23:00:50 -0500 (Tue, 04 Oct 2011) | 1 line
+
+Commiting templates for pcbank.
+------------------------------------------------------------------------
+r10 | kveroneau | 2011-10-04 23:00:18 -0500 (Tue, 04 Oct 2011) | 1 line
+
+Updated models and templates.
+------------------------------------------------------------------------
+r9 | kveroneau | 2011-10-04 21:37:20 -0500 (Tue, 04 Oct 2011) | 1 line
+
+Initial import of PC Banking App.
+------------------------------------------------------------------------

pcbank/templates/pcbank/bank_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Title:</b></td><td>{{object.title}}</td></tr>
+<tr><td><b>Card number:</b></td><td>{{object.card}}</td></tr>
+<tr><td><b>Balance:</b></td><td>${{object.balance|floatformat:2}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.active}}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+<tr><td><b>Online banking:</b></td><td><a href="{{object.url}}" class="btn btn-success">Access account</a></td></tr>
+</table>
+<a href="{{object.get_edit_url}}" class="btn">Edit Bank</a>
+<form action="{% url bank-transfer object.pk %}" method="post">{% csrf_token %}
+<b>Transfer:</b> <input type="text" name="amount"/>
+<b>To Bank:</b> {% bank_list %}
+<input type="submit" value="Do Transfer" class="btn btn-primary" />
+</form>
+{% if object.transactions.all %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Date</th><th>To</th><th>Amount</th></tr>
+</thead><tbody>
+{% for transaction in object.transactions.all %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.content_object.get_absolute_url}}">{{transaction.content_object}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+{% if object.income.all %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Date</th><th>From</th><th>Amount</th></tr>
+</thead><tbody>
+{% for transaction in object.income.all %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.from_obj.get_absolute_url}}">{{transaction.from_obj}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/bank_dropdown.html

+<select name="bank_id">{% for bank in bank_list %}<option value="{{bank.pk}}">{{bank.title}} - ${{bank.balance|floatformat:2}}</option>{% endfor %}</select>

pcbank/templates/pcbank/bank_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary" /></form>
+{% endblock %} 

pcbank/templates/pcbank/bank_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Banks</h2>
+<table class="table">
+<thead>
+<tr><th>Bank</th><th>Balance</th></tr>
+</thead><tbody>
+{% for acct in object_list %}
+<tr><td><a href="{{acct.get_absolute_url}}">{{acct.title}}</a></td><td>${{acct.balance|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/base.html

+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Kevin's PC Bank</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <!-- Le styles -->
+    <link href="{{STATIC_URL}}css/bootstrap.min.css" rel="stylesheet">
+    <style>
+      body {
+        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
+      }
+    </style>
+    <link href="{{STATIC_URL}}css/bootstrap-responsive.min.css" rel="stylesheet">
+    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+    <!--[if lt IE 9]>
+      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+
+  <body>
+
+    <div class="navbar navbar-fixed-top">
+      <div class="navbar-inner">
+        <div class="container">
+
+          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </a>
+          <a class="brand" href="{% url pcbank.views.overview %}">PCBank</a>
+          <div class="nav-collapse">
+            <ul class="nav">
+              <li><a href="{% url pcbank.views.overview %}">Home</a></li>
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown">New<b class="caret"></b></a>
+                <ul class="dropdown-menu">
+                  <li><a href="{% url add-income %}">Income</a></li>
+                  <li><a href="{% url add-cc %}">Credit Card</a></li>
+                  <li><a href="{% url add-payee %}">Payee</a></li>
+                  <li><a href="{% url add-bill %}">Bill</a></li>
+                  <li><a href="{% url add-bank %}">Bank</a></li>
+                  <li><a href="{% url add-cheque %}">Cheque</a></li>
+                  <li><a href="{% url add-roommate %}">Roommate</a></li>
+                </ul>
+              </li>
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Tables<b class="caret"></b></a>
+                <ul class="dropdown-menu">
+                  <li><a href="{% url pcbank.views.credit_table %}">Credit Cards</a></li>
+                  <li><a href="{% url pcbank.views.bill_table %}">Bills</a></li>
+                </ul>
+              </li>
+            </ul>
+          </div><!--/.nav-collapse -->
+        </div>
+      </div>
+    </div>
+
+    <div class="container-fluid">
+      <div class="row-fluid">
+        <div class="span3">
+          <div class="well sidebar-nav">
+            <ul class="nav nav-list">
+              <li class="nav-header">Kevin's PC Bank</li>
+              <li><a href="{% url pcbank.views.overview %}">Home</a></li>
+              <li><a href="{% url list-income %}">Income</a></li>
+              <li><a href="{% url list-cc %}">Credit Cards</a></li>
+              <li><a href="{% url list-payee %}">Payees</a></li>
+              <li><a href="{% url list-bill %}">Bills</a></li>
+              <li><a href="{% url list-bank %}">Banks</a></li>
+              <li><a href="{% url list-transaction %}">Transactions</a></li>
+              <li><a href="{% url list-cheques %}">Cheque Book</a></li>
+              <li><a href="{% url list-roommate %}">Roommates</a></li>
+              <li><a href="{% url monthly-budget %}">Monthly Budget</a></li>
+            </ul>
+          </div>
+        </div>
+        <div class="span9">
+          <div id="messages">
+            {% if messages %}
+            {% for message in messages %}
+            <div class="alert alert-{{message.tags}}">
+            {{message|safe}}
+            </div>
+            {% endfor %}
+            {% endif %}
+          </div>
+          {% block body %}Body{% endblock %}
+        </div>
+      </div>
+      <div class="row-fluid">
+        <div class="span12">
+        <center><address>
+<a href="http://www.python.org/">Python</a> Powered | &copy; 2012 Kevin Veroneau
+        </address></center>
+        </div>
+      </div>
+    </div> <!-- /container -->
+    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
+    <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
+    <!-- Le javascript
+    ================================================== -->
+    <!-- Placed at the end of the document so the pages load faster
+    <script src="../assets/js/jquery.js"></script>
+    <script src="../assets/js/bootstrap-transition.js"></script>
+    <script src="../assets/js/bootstrap-alert.js"></script>
+    <script src="../assets/js/bootstrap-modal.js"></script>
+
+    <script src="../assets/js/bootstrap-dropdown.js"></script>
+    <script src="../assets/js/bootstrap-scrollspy.js"></script>
+    <script src="../assets/js/bootstrap-tab.js"></script>
+    <script src="../assets/js/bootstrap-tooltip.js"></script>
+    <script src="../assets/js/bootstrap-popover.js"></script>
+    <script src="../assets/js/bootstrap-button.js"></script>
+
+    <script src="../assets/js/bootstrap-collapse.js"></script>
+    <script src="../assets/js/bootstrap-carousel.js"></script>
+    <script src="../assets/js/bootstrap-typeahead.js"></script>
+ -->
+  </body>
+</html>

pcbank/templates/pcbank/bill_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Title:</b></td><td>{{object.payee.title}}</td></tr>
+<tr><td><b>Account:</b></td><td>{{object.payee.account}}</td></tr>
+<tr><td><b>Split by:</b></td><td>{{object.payee.split_by}}</td></tr>
+<tr><td><b>Due Date:</b></td><td>{{object.payee.due_date}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.payee.active}}</td></tr>
+<tr><td><b>Amount:</b></td><td>${{object.split_amount|floatformat:2}}</td></tr>
+<tr><td><b>Paid:</b></td><td>{{object.paid}}{% if not object.paid %}<i><a href="{{object.mark_paid}}"><i class="icon-check"></i></a></i>{% endif %}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+</table>
+<div class="btn-group">
+  <a href="{{object.get_edit_url}}" class="btn">Edit Bill</a>
+  <a href="{{object.payee.get_edit_url}}" class="btn">Edit Payee</a>
+</div>
+{% if not object.paid %}
+<form action="{{object.bank_payment}}" method="post">{% csrf_token %}
+<b>Bank transfer:</b> {% bank_list %}
+<input type="submit" value="Do Payment" class="btn btn-primary" />
+</form>
+<form action="{{object.cc_payment}}" method="post">{% csrf_token %}
+<b>Credit Card payment:</b> {% cc_list %}
+<input type="submit" value="Do Payment" class="btn btn-primary" />
+</form>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/bill_dropdown.html

+<select name="bill_id">{% for bill in bill_list %}<option value="{{bill.pk}}">{{bill.payee}} - ${{bill.split_amount}}</option>{% endfor %}</select>

pcbank/templates/pcbank/bill_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary" /></form>
+{% endblock %} 

pcbank/templates/pcbank/bill_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Bills</h2>
+<table class="table">
+<thead>
+<tr><th>Payee</th><th>Amount</th><th>Due Date</th></tr>
+</thead><tbody>
+{% for bill in object_list %}
+<tr><td><a href="{{bill.payee.get_absolute_url}}">{{bill.payee.title}}</a></td><td><a href="{{bill.get_absolute_url}}">${{bill.amount|floatformat:2}}</a></td><td>{{bill.payee.due_date}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %} 

pcbank/templates/pcbank/bill_table.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<table class="table">
+<thead>
+<tr><th>Bill</th><th>Amount</th><th>Due by</th></tr>
+</thead><tbody>
+{% for bill in bill_list %}
+<tr><td><b><a href="{{bill.get_absolute_url}}">{{bill.payee.title}}</a>:</b></td><td>${{bill.split_amount|floatformat:2}}</td><td>{{bill.payee.due_date}}</td></tr>
+{% endfor %}
+{% if cc_due > 0 %}<tr><td><b><a href="{% url pcbank.views.credit_table %}">Credit Cards</a>:</b></td><td>${{cc_due|floatformat:2}}</td><td><i>See individual Cards</i></td></tr>{% endif %}
+<tr><td><b>Total:</b></td><td>${{total_due|floatformat:2}}</td><td>&nbsp;</td></tr>
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/cc_dropdown.html

+<select name="cc_id">{% for cc in cc_list %}<option value="{{cc.pk}}">{{cc.title}} - ${{cc.available_credit|floatformat:2}}</option>{% endfor %}</select> 

pcbank/templates/pcbank/cheque_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+{% if not object.transaction %}<form action="{% url assign-transaction object.number %}" method="post">{% csrf_token %}{% endif %}
+<table class="table table-condensed">
+<tr><td><b>Cheque #</b></td><td>{{object.number}}</td></tr>
+<tr><td><b>Amount</b></td><td>${{object.amount|floatformat:2}}</td></tr>
+<tr><td><b>Transaction:</b></td><td>{% if object.transaction %}<a href="{{object.transaction.get_absolute_url}}">{{object.transaction}}</a>{% else %}{% transaction_list object.amount %}{% endif %}</td></tr>
+<tr><td><b>Post Date:</b></td><td>{{object.post_date}}</td></tr>
+</table>
+{% if not object.transaction %}<input type="submit" value="Assign Transaction" class="btn btn-primary" /></form>{% endif %}
+<p>{{object.memo|linebreaksbr}}</p>
+{% if object.image %}<img src="{{object.image.url}}"/>{% endif %}
+{% endblock %}

pcbank/templates/pcbank/cheque_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary" /></form>
+{% endblock %}

pcbank/templates/pcbank/cheque_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Cheque Book</h2>
+<table class="table">
+<thead>
+<tr><th>Cheque number</th><th>Amount</th><th>Date</th><th>Transaction</th></tr>
+</thead><tbody>
+{% for cheque in object_list %}
+<tr><td><a href="{{cheque.get_absolute_url}}">{{cheque.number}}</a></td><td>${{cheque.amount|floatformat:2}}</td><td>{{cheque.post_date}}</td><td>{% if cheque.transaction %}<a href="{{cheque.transaction.get_absolute_url}}">{{cheque.transaction}}</a>{% else %}None{% endif %}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/credit_table.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<table class="table">
+<thead>
+<tr><th>&nbsp;</th><th>Balance</th><th>Credit</th><th>Payment Due</th></tr>
+</thead><tbody>
+{% for cc in cc_list %}
+<tr><td><b><a href="{{cc.get_absolute_url}}">{{cc.title}}</a>:</b></td><td>${{cc.balance|floatformat:2}}</td><td>${{cc.available_credit|floatformat:2}}</td><td>${{cc.min_payment|floatformat:2}}</td></tr>
+{% endfor %}
+<tr><td><b>Total:</b></td><td>${{total_balance|floatformat:2}}</td><td>${{total_credit|floatformat:2}}</td><td>${{total_due|floatformat:2}}</td></tr>
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/creditcard_detail.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Title:</b></td><td>{{object.title}}</td></tr>
+<tr><td><b>Credit:</b></td><td>${{object.credit|floatformat:2}}</td></tr>
+<tr><td><b>Balance:</b></td><td>${{object.balance|floatformat:2}}</td></tr>
+<tr><td><b>Available Credit:</b></td><td>${{object.available_credit|floatformat:2}}</td></tr>
+<tr><td><b>Minimum Payment:</b></td><td>${{object.min_payment|floatformat:2}}</td></tr>
+<tr><td><b>Due Date:</b></td><td>{{object.due_date}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.active}}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+<tr><td><b>Online banking:</b></td><td><a href="{{object.url}}" class="btn btn-success">Access account</a></td></tr>
+</table>
+<a href="{{object.get_edit_url}}" class="btn">Edit Credit Card</a>
+{% if object.transactions.all %}
+<table border="1">
+<tr><th>Date</th><th>To</th><th>Amount</th></tr>
+{% for transaction in object.transactions.all %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.content_object.get_absolute_url}}">{{transaction.content_object}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</table>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/creditcard_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table table-condensed">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary"></form>
+{% endblock %} 

pcbank/templates/pcbank/creditcard_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Credit Cards</h2>
+<table class="table">
+<thead>
+<tr><th>Title</th><th>Balance</th><th>Available Credit</th><th>Minimum Payment</th></tr>
+</thead><tbody>
+{% for cc in object_list %}
+<tr><td><a href="{{cc.get_absolute_url}}">{{cc.title}}</a></td><td>${{cc.balance|floatformat:2}}</td><td>${{cc.available_credit|floatformat:2}}</td><td>${{cc.min_payment|floatformat:2}} by {{cc.due_date}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %} 

pcbank/templates/pcbank/income_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Title:</b></td><td>{{object.title}}</td></tr>
+<tr><td><b>Income:</b></td><td>${{object.amount|floatformat:2}}</td></tr>
+<tr><td><b>Per month:</b></td><td>{{object.per_month}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.active}}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+{% if object.per_month > 1 %}
+<tr><td><b>Monthly Income:</b></td><td>${{object.monthly_amount|floatformat:2}}</td></tr>
+{% endif %}
+<tr><td><b>Yearly Income:</b></td><td>${{object.yearly_amount|floatformat:2}}</td></tr>
+</table>
+<a href="{{object.get_edit_url}}" class="btn">Edit Income</a><br/>
+<form action="{{object.payday}}" method="post">{% csrf_token %}
+<b>Payday transfer:</b> {% bank_list %}
+<input type="submit" value="Do Payment" class="btn btn-primary" />
+</form>
+{% endblock %}

pcbank/templates/pcbank/income_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary"></form>
+{% endblock %}

pcbank/templates/pcbank/income_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Income list</h2>
+<table class="table">
+<thead>
+<tr><th>Income</th><th>Amount</th></tr>
+</thead><tbody>
+{% for acct in object_list %}
+<tr><td><a href="{{acct.get_absolute_url}}">{{acct.title}}</a></td><td>${{acct.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/index.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Financial Overview</h2>
+<table class="table">
+<tr><td><b>Monthly Income:</b></td><td>${{income|floatformat:2}}</td></tr>
+<tr><td><b><a href="{% url pcbank.views.bill_table %}">Current Bills</a>:</b></td><td>${{bills|floatformat:2}}</td></tr>
+<tr><td><b><a href="{% url pcbank.views.credit_table %}">Total Credit</a>:</b></td><td>${{credit|floatformat:2}}</td></tr>
+<tr><td><b>Total Debt:</b></td><td>${{debt|floatformat:2}}</td></tr>
+<tr><td><b>Net Worth:</b></td><td>${{worth|floatformat:2}}</td></tr>
+<tr><td><b>Available funds:</b></td><td>${{available_funds|floatformat:2}}</td></tr>
+<tr><td><b>Roommates owing:</b></td><td>${{roommate_due|floatformat:2}}</td></tr>
+</table>
+<p><b>Net Worth</b> = <b>Total Bank Balances</b> - <b>Debt</b> - <b>Bills</b></p>
+<p><b>Available Funds</b> = <b>Credit</b> + <b>Total Bank Balances</b> - <b>Bills</b></p>
+{% endblock %}

pcbank/templates/pcbank/monthly_budget.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>{{today|date:"F Y"}}</h2>
+<table class="table table-striped table-bordered table-condensed">
+<tr><td><b>Bank</b></td><td>${{banks|floatformat:2}}</td></tr>
+<tr><td><b>Income</b></td><td>${{total_income|floatformat:2}}</td></tr>
+<tr><td><b>Total</b></td><td>${{total|floatformat:2}}</td></tr>
+{% for bill in bill_list %}
+<tr><td><b><a href="{{bill.get_absolute_url}}">{{bill.payee.title}}</a></b></td><td>${{bill.split_amount|floatformat:2}}</td></tr>
+{% endfor %}
+<tr><td><b>Credit Cards</b></td><td>${{cc|floatformat:2}}</td></tr>
+<tr><td><b>Total bills</b></td><td>${{bills|floatformat:2}}</td></tr>
+<tr><td><b>Left</b></td><td>${{left|floatformat:2}}</td></tr>
+<tr><td><b>Per week</b></td><td>${{per_week|floatformat:2}}</td></tr>
+<tr><td><b>Weeks</b></td><td>{{paydays}}</td></tr>
+</table>
+{% if not month %}
+<a href="?month={{next_month.month}}">{{next_month|date:"F Y"}}</a>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/paginator.html

+<div class="pagination">
+  <ul>
+    {% for page in page_range %}<li><a href="?page={{page}}">{{page}}</a></li>{% endfor %}
+  </ul>
+</div>

pcbank/templates/pcbank/payee_detail.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Title:</b></td><td>{{object.title}}</td></tr>
+<tr><td><b>Account:</b></td><td>{{object.account}}</td></tr>
+<tr><td><b>Split by:</b></td><td>{{object.split_by}}</td></tr>
+<tr><td><b>Due Date:</b></td><td>{{object.due_date}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.active}}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+{% if object.url %}
+<tr><td><b>Account website:</b></td><td><a href="{{object.url}}" class="btn btn-success">Access account</a></td></tr>
+{% endif %}
+</table>
+<a href="{{object.get_edit_url}}" class="btn">Edit Payee</a><br/>
+<form action="{{object.add_bill}}" method="post">{% csrf_token %}
+{{form}}
+<input type="submit" value="Add Bill" class="btn btn-primary" />
+</form>
+{% if object.bill_set.count > 0 %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Added on</th><th>Amount</th><th>Paid</th></tr>
+</thead><tbody>
+{% for bill in object.bill_set.all %}
+<tr><td><a href="{{bill.get_absolute_url}}">{{bill.added_on}}</a></td><td>${{bill.amount|floatformat:2}}</td><td>{{bill.paid}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+{% if object.transactions.all %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Date</th><th>From</th><th>Amount</th></tr>
+</thead><tbody>
+{% for transaction in object.transactions.all %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.from_obj.get_absolute_url}}">{{transaction.from_obj}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/payee_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary" /></form>
+{% endblock %} 

pcbank/templates/pcbank/payee_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Payee list</h2>
+<table class="table">
+<thead>
+<tr><th>Title</th><th>Account</th><th>Due Date</th></tr>
+</thead><tbody>
+{% for payee in object_list %}
+<tr><td><a href="{{payee.get_absolute_url}}">{{payee}}</a></td><td><a href="{{payee.url|default:payee.get_absolute_url}}">{{payee.account}}</a></td><td>{{payee.due_date}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %}

pcbank/templates/pcbank/roommate_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>Name:</b></td><td>{{object.name}}</td></tr>
+<tr><td><b>Total given:</b></td><td>${{object.total_given|floatformat:2}}</td></tr>
+<tr><td><b>Active:</b></td><td>{{object.active}}</td></tr>
+<tr><td><b>Added on:</b></td><td>{{object.added_on}}</td></tr>
+</table>
+<a href="{{object.get_edit_url}}" class="btn">Edit Roommate</a><br/>
+{% if object.roommatebill_set.all %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Bill</th><th>Amount</th><th>Paid</th></tr>
+</thead><tbody>
+{% for bill in object.roommatebill_set.all %}
+<tr><td><a href="{{bill.get_absolute_url}}">{{bill}}</a></td><td>${{bill.amount|floatformat:2}}</td><td>{{bill.paid}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+<form action="{{object.add_bill}}" method="post">{% csrf_token %}
+<b>Add Bill:</b> {% bill_list %}
+<input type="submit" value="Add" class="btn btn-primary" />
+</form>
+{% if object.transactions.all %}
+<table class="table table-striped table-condensed table-bordered">
+<thead>
+<tr><th>Date</th><th>To</th><th>Amount</th></tr>
+</thead><tbody>
+{% for transaction in object.transactions.all %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.content_object.get_absolute_url}}">{{transaction.content_object}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endif %}
+{% endblock %} 

pcbank/templates/pcbank/roommate_form.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<form action="" method="post">{% csrf_token %}
+<table class="table">
+{{form}}
+</table>
+<input type="submit" value="Save" class="btn btn-primary" /></form>
+{% endblock %} 

pcbank/templates/pcbank/roommate_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Roommates</h2>
+<table class="table">
+{% for roommate in object_list %}
+<tr><td><a href="{{roommate.get_absolute_url}}">{{roommate}}</a></td></tr>
+{% endfor %}
+</table>
+{% endblock %} 

pcbank/templates/pcbank/roommatebill_detail.html

+{% extends "pcbank/base.html" %}
+{% load pcbank_extras %}
+
+{% block body %}
+<table class="table">
+<tr><td><b>Name:</b></td><td><a href="{{object.roommate.get_absolute_url}}">{{object.roommate}}</a></td></tr>
+<tr><td><b>Bill:</b></td><td><a href="{{object.for_bill.get_absolute_url}}">{{object.for_bill.payee}}</a></td></tr>
+<tr><td><b>Amount:</b></td><td>${{object.amount|floatformat:2}}</td></tr>
+{% if object.paid %}
+<tr><td><b>Paid on:</b></td><td>{{object.pay_date}}</td></tr>
+{% else %}
+<tr><td><b>Past Due:</b></td><td>{{object.past_due}}</td></tr>
+<tr><td><b>Due Date:</b></td><td>{{object.for_bill.payee.due_date}}</td></tr>
+{% endif %}
+</table>
+{% if not object.paid %}
+<form action="{{object.make_payment}}" method="post">{% csrf_token %}
+<b>Payment transfer:</b> {% bank_list %}
+<input type="submit" value="Do Payment" class="btn btn-primary" />
+</form>
+{% endif %}
+{% endblock %}

pcbank/templates/pcbank/transaction_detail.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<table class="table table-condensed">
+<tr><td><b>From:</b></td><td><a href="{{object.from_obj.get_absolute_url}}">{{object.from_obj}}</a></td></tr>
+<tr><td><b>To:</b></td><td><a href="{{object.content_object.get_absolute_url}}">{{object.content_object}}</a></td></tr>
+<tr><td><b>Amount:</b></td><td>${{object.amount|floatformat:2}}</td></tr>
+<tr><td><b>Date of transaction:</b></td><td>{{object.date}}</td></tr>
+</table>
+{% if object.memo %}{{object.memo|linebreaksbr}}{% endif %}
+{% endblock %}

pcbank/templates/pcbank/transaction_dropdown.html

+<select name="transaction_id">{% for transaction in transaction_list %}<option value="{{transaction.pk}}">{{transaction}}</option>{% endfor %}</select>

pcbank/templates/pcbank/transaction_list.html

+{% extends "pcbank/base.html" %}
+
+{% block body %}
+<h2>Transactions</h2>
+{% include "pcbank/paginator.html" %}
+<table class="table table-striped">
+<thead>
+<tr><th>Date</th><th>From</th><th>To</th><th>Amount</th></tr>
+</thead><tbody>
+{% for transaction in object_list %}
+<tr><td>{{transaction.date}}</td><td><a href="{{transaction.from_obj.get_absolute_url}}">{{transaction.from_obj}}</a></td><td><a href="{{transaction.content_object.get_absolute_url}}">{{transaction.content_object}}</a></td><td>${{transaction.amount|floatformat:2}}</td></tr>
+{% endfor %}
+</tbody></table>
+{% endblock %}

pcbank/templatetags/__init__.py

+ 

pcbank/templatetags/pcbank_extras.py

+# -*- coding: utf-8 -*-
+from django import template
+from django.template import Context
+from pcbank.models import Bank, CreditCard, Bill, Transaction
+
+register = template.Library()
+
+@register.simple_tag
+def bank_list():
+    """
+    Generates a dropdown list of all the currently active bank accounts.
+
+    Usage::
+
+        {% bank_list %}
+    """
+    bank_list = Bank.objects.filter(active=True)
+    t = template.loader.get_template('pcbank/bank_dropdown.html')
+    return t.render(Context({'bank_list':bank_list}))
+
+@register.simple_tag
+def cc_list():
+    """
+    Generates a dropdown list of all the currently active credit cards.
+
+    Usage::
+
+        {% cc_list %}
+    """
+    cc_list = CreditCard.objects.filter(active=True)
+    t = template.loader.get_template('pcbank/cc_dropdown.html')
+    return t.render(Context({'cc_list':cc_list}))
+
+@register.simple_tag
+def bill_list():
+    """
+    Generates a dropdown list of all the currently active bills.
+
+    Usage::
+
+        {% bill_list %}
+    """
+    bill_list = Bill.objects.filter(paid=False, payee__split_by__gt=1)
+    t = template.loader.get_template('pcbank/bill_dropdown.html')
+    return t.render(Context({'bill_list':bill_list}))
+
+@register.inclusion_tag('pcbank/transaction_dropdown.html')
+def transaction_list(amount):
+    transaction_list = Transaction.objects.filter(amount=amount)
+    return {'transaction_list':transaction_list}
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
+# -*- coding: utf-8 -*-
+from django.conf.urls.defaults import patterns, url
+from pcbank.models import Income, CreditCard, Payee, Bill, Bank, Transaction, Roommate, RoommateBill,\
+    Cheque
+from pcbank.forms import NewBillForm, NewChequeForm
+from pcbank.feeds import BankingBookmarks
+
+urlpatterns = patterns('pcbank.views',
+    (r'^$', 'overview'),
+    url(r'^Income/add.py$', 'create', {'model':Income}, name='add-income'),
+    url(r'^Income/$', 'show_list', {'queryset':Income.objects.filter(active=True)}, name='list-income'),
+    url(r'^Income/(?P<object_id>\d+)/edit.py$', 'update', {'model':Income}, name='edit-income'),
+    url(r'^Income/(?P<object_id>\d+)/$', 'details', {'queryset':Income.objects.all()}, name='view-income'),
+    url(r'^CreditCard/add.py$', 'create', {'model':CreditCard}, name='add-cc'),
+    url(r'^CreditCard/$', 'show_list', {'queryset':CreditCard.objects.filter(active=True)}, name='list-cc'),
+    url(r'^CreditCard/(?P<object_id>\d+)/edit.py$', 'update', {'model':CreditCard}, name='edit-cc'),
+    url(r'^CreditCard/(?P<object_id>\d+)/$', 'details', {'queryset':CreditCard.objects.all()}, name='view-cc'),
+    url(r'^Payee/add.py$', 'create', {'model':Payee}, name='add-payee'),
+    url(r'^Payee/$', 'show_list', {'queryset':Payee.objects.filter(active=True)}, name='list-payee'),
+    url(r'^Payee/(?P<object_id>\d+)/edit.py$', 'update', {'model':Payee}, name='edit-payee'),
+    url(r'^Payee/(?P<object_id>\d+)/$', 'details', {'queryset':Payee.objects.all(), 'extra_context':{'form':NewBillForm()}}, name='view-payee'),
+    url(r'^Bill/add.py$', 'create', {'model':Bill}, name='add-bill'),
+    url(r'^Bill/$', 'show_list', {'queryset':Bill.objects.filter(paid=False)}, name='list-bill'),
+    url(r'^Bill/(?P<object_id>\d+)/edit.py$', 'update', {'model':Bill}, name='edit-bill'),
+    url(r'^Bill/(?P<object_id>\d+)/$', 'details', {'queryset':Bill.objects.all()}, name='view-bill'),
+    url(r'^Bank/add.py$', 'create', {'model':Bank}, name='add-bank'),
+    url(r'^Bank/$', 'show_list', {'queryset':Bank.objects.filter(active=True)}, name='list-bank'),
+    url(r'^Bank/(?P<object_id>\d+)/edit.py$', 'update', {'model':Bank}, name='edit-bank'),
+    url(r'^Bank/(?P<object_id>\d+)/$', 'details', {'queryset':Bank.objects.all()}, name='view-bank'),
+    url(r'^Transaction/$', 'show_list', {'queryset':Transaction.objects.all(),'paginate_by':20}, name='list-transaction'),
+    url(r'^Transaction/(?P<object_id>\d+)/$', 'details', {'queryset':Transaction.objects.all()}, name='view-transaction'),
+    url(r'^ChequeBook/$', 'show_list', {'queryset':Cheque.objects.all()}, name='list-cheques'),
+    url(r'^ChequeBook/add.py$', 'create', {'model':Cheque, 'form_class':NewChequeForm}, name='add-cheque'),
+    url(r'^ChequeBook/(?P<cheque_id>\d+)/assign_transaction.py$', 'assign_transaction', name='assign-transaction'),
+    url(r'^ChequeBook/(?P<slug>\d+)/$', 'details', {'queryset':Cheque.objects.all(), 'slug_field':'number'}, name='view-cheque'),
+    url(r'^Roommate/add.py$', 'create', {'model':Roommate}, name='add-roommate'),
+    url(r'^Roommate/$', 'show_list', {'queryset':Roommate.objects.filter(active=True)}, name='list-roommate'),
+    url(r'^Roommate/(?P<object_id>\d+)/edit.py$', 'update', {'model':Roommate}, name='edit-roommate'),
+    url(r'^Roommate/(?P<object_id>\d+)/$', 'details', {'queryset':Roommate.objects.all()}, name='view-roommate'),
+    url(r'^RoommateBill/$', 'show_list', {'queryset':RoommateBill.objects.all()}, name='list-roommatebill'),
+    url(r'^RoommateBill/(?P<object_id>\d+)/$', 'details', {'queryset':RoommateBill.objects.all()}, name='view-roommatebill'),
+    (r'^CreditCard/table.py$', 'credit_table'),
+    (r'^Bill/table.py$', 'bill_table'),
+    (r'^Bill/(?P<object_id>\d+)/mark_paid.py$', 'mark_paid'),
+    (r'^Income/(?P<object_id>\d+)/payday.py$', 'payday'),
+    (r'^Bill/(?P<object_id>\d+)/bank_payment.py$', 'make_bank_payment'),
+    (r'^Bill/(?P<object_id>\d+)/cc_payment.py$', 'make_cc_payment'),
+    (r'^Payee/(?P<object_id>\d+)/add_bill.py$', 'add_bill'),
+    (r'^Roommate/(?P<object_id>\d+)/add_bill.py$', 'add_roommatebill'),
+    (r'^RoommateBill/(?P<object_id>\d+)/payment.py$', 'roommate_payment'),
+    url(r'^Bank/(?P<object_id>\d+)/transfer.py$', 'bank_transfer', name='bank-transfer'),
+    url(r'^MonthlyBudget.py$', 'monthly_budget', name='monthly-budget'),
+    (r'^Service.py$', 'json_service'),
+    (r'^Bookmarks.rss$', BankingBookmarks()),
+)
+# -*- coding: utf-8 -*-
+from django.core.exceptions import PermissionDenied
+from django.views.generic.create_update import create_object, update_object, delete_object
+from django.views.generic.list_detail import object_list, object_detail
+from django.views.generic.simple import direct_to_template
+from pcbank.models import CreditCard, Bill, Income, Bank, Payee, Transaction, Roommate, RoommateBill,\
+    Cheque
+from decimal import Decimal
+from django.shortcuts import render_to_response, redirect
+from pcbank.forms import NewBillForm
+from django.template import RequestContext
+import datetime
+from django.contrib.auth.decorators import login_required
+from django.http import HttpResponse
+from django.utils import simplejson
+
+@login_required
+def overview(req):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    total_income = Decimal("0.00")
+    for income in Income.objects.filter(active=True):
+        total_income += income.monthly_amount()
+    bills = Decimal("0.00")
+    for bill in Bill.objects.filter(paid=False):
+        bills += bill.split_amount()
+    credit = Decimal("0.00")
+    debt = Decimal("0.00")
+    for cc in CreditCard.objects.filter(active=True):
+        credit += cc.available_credit()
+        debt += cc.balance
+    worth = Decimal("0.00")
+    for bank in Bank.objects.filter(active=True):
+        worth += bank.balance
+    available_funds = credit + worth - bills
+    worth -= debt
+    worth -= bills
+    roommate_due = Decimal("0.00")
+    for bill in RoommateBill.objects.filter(paid=False):
+        roommate_due += bill.amount()
+    return render_to_response('pcbank/index.html', {'income':total_income, 'bills':bills, 'credit':credit, 'debt':debt, 'worth':worth, 'available_funds':available_funds, 'roommate_due':roommate_due})
+
+@login_required
+def create(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return create_object(req, *args, **kwargs)
+
+@login_required
+def update(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return update_object(req, *args, **kwargs)
+
+@login_required
+def delete(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return delete_object(req, *args, **kwargs)
+
+@login_required
+def show_list(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return object_list(req, *args, **kwargs)
+
+@login_required
+def details(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return object_detail(req, *args, **kwargs)
+
+@login_required
+def flatpage(req, *args, **kwargs):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    return direct_to_template(req, *args, **kwargs)
+
+@login_required
+def credit_table(req):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    cc_list = CreditCard.objects.filter(active=True)
+    total_balance = Decimal('0.00')
+    total_credit = Decimal('0.00')
+    total_due = Decimal('0.00')
+    for cc in cc_list:
+        total_balance += cc.balance
+        total_credit += (cc.credit - cc.balance)
+        total_due += cc.min_payment
+    return render_to_response('pcbank/credit_table.html', {'cc_list':cc_list, 'total_balance':total_balance, 'total_credit':total_credit, 'total_due':total_due})
+
+@login_required
+def bill_table(req):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    bill_list = Bill.objects.filter(paid=False).order_by('payee__due_date')
+    cc_list = CreditCard.objects.filter(active=True, min_payment__gt=0)
+    cc_due = Decimal('0.00')
+    for cc in cc_list:
+        cc_due += cc.min_payment
+    total_due = Decimal('0.00')
+    for bill in bill_list:
+        total_due += bill.split_amount()
+    total_due += cc_due
+    return render_to_response('pcbank/bill_table.html', {'bill_list':bill_list, 'total_due':total_due, 'cc_due':cc_due})
+
+@login_required
+def mark_paid(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    bill = Bill.objects.get(pk=object_id)
+    bill.paid = True
+    bill.save()
+    return redirect('view-bill', object_id=object_id)
+
+@login_required
+def payday(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    if req.POST.get('bank_id', 'None') == 'None':
+        raise PermissionDenied
+    income = Income.objects.get(pk=object_id)
+    bank = Bank.objects.get(pk=req.POST.get('bank_id', 1))
+    bank.balance += income.amount
+    bank.save()
+    t = Transaction(from_obj=income, amount=income.amount, content_object=bank)
+    t.save()
+    return redirect('view-bank', object_id=bank.pk)
+
+@login_required
+def make_bank_payment(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    if req.POST.get('bank_id', 'None') == 'None':
+        raise PermissionDenied
+    bill = Bill.objects.get(pk=object_id)
+    bank = Bank.objects.get(pk=req.POST.get('bank_id', 1))
+    bank.balance -= bill.amount
+    bank.save()
+    bill.paid = True
+    bill.save()
+    payee = bill.payee
+    t = Transaction(from_obj=bank, amount=bill.amount, content_object=payee)
+    t.save()
+    due_month = payee.due_date.month + 1
+    if due_month > 12:
+        payee.due_date = datetime.date(payee.due_date.year + 1, 1, payee.due_date.day)
+    else:
+        payee.due_date = datetime.date(payee.due_date.year, due_month, payee.due_date.day)
+    payee.save()
+    return redirect('view-bank', object_id=bank.pk)
+
+@login_required
+def make_cc_payment(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    if req.POST.get('cc_id', 'None') == 'None':
+        raise PermissionDenied
+    bill = Bill.objects.get(pk=object_id)
+    cc = CreditCard.objects.get(pk=req.POST.get('cc_id', 1))
+    cc.balance += bill.amount
+    cc.save()
+    bill.paid = True
+    bill.save()
+    payee = bill.payee
+    t = Transaction(from_obj=cc, amount=bill.amount, content_object=payee)
+    t.save()
+    due_month = payee.due_date.month + 1
+    if due_month > 12:
+        payee.due_date = datetime.date(payee.due_date.year + 1, 1, payee.due_date.day)
+    else:
+        payee.due_date = datetime.date(payee.due_date.year, due_month, payee.due_date.day)
+    payee.save()
+    return redirect('view-cc', object_id=cc.pk)
+
+@login_required
+def add_bill(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    payee = Payee.objects.get(pk=object_id)
+    form = NewBillForm(req.POST)
+    if form.is_valid():
+        bill = form.save(commit=False)
+        bill.payee = payee
+        bill.save()
+        return redirect(bill)
+    return render_to_response('pcbank/payee_detail.html', {'object':payee, 'form':form}, context_instance=RequestContext(req))
+
+@login_required
+def add_roommatebill(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    if req.POST.get('bill_id', 'None') == 'None':
+        raise PermissionDenied
+    roommate = Roommate.objects.get(pk=object_id)
+    bill = Bill.objects.get(pk=req.POST.get('bill_id', 1))
+    rbill = RoommateBill(roommate=roommate, for_bill=bill)
+    rbill.save()
+    return redirect(rbill)
+
+@login_required
+def roommate_payment(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':
+        raise PermissionDenied
+    if req.POST.get('bank_id', 'None') == 'None':
+        raise PermissionDenied
+    rbill = RoommateBill.objects.get(pk=object_id)
+    bank = Bank.objects.get(pk=req.POST.get('bank_id', 1))
+    bank.balance += rbill.amount()
+    bank.save()
+    rbill.paid = True
+    rbill.pay_date = datetime.date.today()
+    rbill.save()
+    rmate = rbill.roommate
+    rmate.total_given += rbill.amount()
+    rmate.save()
+    t = Transaction(from_obj=rbill.roommate, amount=rbill.amount(), content_object=bank)
+    t.save()
+    return redirect('view-bank', object_id=bank.pk)
+
+@login_required
+def bank_transfer(req, object_id):
+    if not req.user.is_superuser:
+        raise PermissionDenied
+    if req.method == 'GET':