From: Tollef Fog Heen Date: Thu, 7 Jun 2012 15:35:11 +0000 (+0200) Subject: Add due date field X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1999e51afbe2ae62900ffa11de117c8bda1ebda;p=peojumk Add due date field --- diff --git a/invoice/migrations/0002_auto__add_field_invoice_due_date.py b/invoice/migrations/0002_auto__add_field_invoice_due_date.py new file mode 100644 index 0000000..8f76e5b --- /dev/null +++ b/invoice/migrations/0002_auto__add_field_invoice_due_date.py @@ -0,0 +1,55 @@ +# -*- 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 'Invoice.due_date' + db.add_column('invoice_invoice', 'due_date', + self.gf('django.db.models.fields.DateField')(default=datetime.datetime(2012, 7, 3, 0, 0)), + keep_default=False) + + def backwards(self, orm): + # Deleting field 'Invoice.due_date' + db.delete_column('invoice_invoice', 'due_date') + + models = { + 'invoice.client': { + 'Meta': {'object_name': 'Client'}, + 'address': ('django.db.models.fields.TextField', [], {}), + 'email': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'invoice.invoice': { + 'Meta': {'object_name': 'Invoice'}, + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'customer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['invoice.Client']"}), + 'date': ('django.db.models.fields.DateField', [], {}), + 'due_date': ('django.db.models.fields.DateField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'invoice.invoiceline': { + 'Meta': {'object_name': 'InvoiceLine'}, + 'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '19', 'decimal_places': '2'}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'hourly_rate': ('django.db.models.fields.DecimalField', [], {'default': '300.0', 'max_digits': '6', 'decimal_places': '2'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'invoice': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['invoice.Invoice']"}), + 'tax': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['invoice.VAT']"}), + 'time': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}) + }, + 'invoice.vat': { + 'Meta': {'object_name': 'VAT'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'percentage': ('django.db.models.fields.DecimalField', [], {'max_digits': '4', 'decimal_places': '2'}) + } + } + + complete_apps = ['invoice'] \ No newline at end of file diff --git a/invoice/models.py b/invoice/models.py index ef2b8cd..9dd8629 100644 --- a/invoice/models.py +++ b/invoice/models.py @@ -22,6 +22,8 @@ class Invoice(models.Model): customer = models.ForeignKey(Client) status = models.CharField(max_length=1, choices=INVOICE_STATUS_CHOICES) date = models.DateField() + due_date = models.DateField() + currency = models.CharField(max_length = 10) def _total_sum(self):