diff --git a/cash/__init__.py b/cash/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cash/admin.py b/cash/admin.py new file mode 100644 index 0000000..75bb2b9 --- /dev/null +++ b/cash/admin.py @@ -0,0 +1,8 @@ +from django.contrib import admin +from cash.models import * + +admin.site.register(Account) +admin.site.register(Product) +admin.site.register(ProductBarcode) +admin.site.register(ProductCategory) + diff --git a/cash/models.py b/cash/models.py new file mode 100644 index 0000000..c686405 --- /dev/null +++ b/cash/models.py @@ -0,0 +1,40 @@ +from django.db import models +from django.contrib.auth.models import User + +class Account(models.Model): + user = models.OneToOneField(User) + card_number = models.CharField(max_length=32) + pin = models.CharField(max_length=32) + daily_digest = models.BooleanField() + credit = models.IntegerField() + +class ProductCategory(models.Model): + name = models.CharField(max_length=32) + comment = models.CharField(max_length=128, blank=True) + +class Product(models.Model): + name = models.CharField(max_length=32) + price = models.IntegerField() + deleted = models.BooleanField() + category = models.ForeignKey(ProductCategory, blank=True, null=True) + +class ProductBarcode(models.Model): + barcode = models.CharField(max_length=32) + comment = models.CharField(max_length=128) + product = models.ForeignKey(Product) + +class Transaction(models.Model): + account = models.ForeignKey(Account) + timestamp = models.DateTimeField(auto_now_add=True) + subject = models.CharField(max_length=32) + description = models.TextField() + amount = models.IntegerField() + +class SalesLogEntry(models.Model): + account = models.ForeignKey(Account) + product = models.ForeignKey(Product) + count = models.IntegerField() + unit_price = models.IntegerField() + timestamp = models.DateTimeField(auto_now_add=True) + + diff --git a/cash/tests.py b/cash/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/cash/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this 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.assertEqual(1 + 1, 2) diff --git a/cash/views.py b/cash/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/cash/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/lugcash2/settings.py b/lugcash2/settings.py index eebb153..882a980 100644 --- a/lugcash2/settings.py +++ b/lugcash2/settings.py @@ -123,6 +123,9 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', + 'django_evolution', + + 'cash' ) # A sample logging configuration. The only tangible logging diff --git a/lugcash2/urls.py b/lugcash2/urls.py index 6bb88a3..68b9a45 100644 --- a/lugcash2/urls.py +++ b/lugcash2/urls.py @@ -1,8 +1,8 @@ from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: -# from django.contrib import admin -# admin.autodiscover() +from django.contrib import admin +admin.autodiscover() urlpatterns = patterns('', # Examples: @@ -13,5 +13,5 @@ urlpatterns = patterns('', # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: - # url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', include(admin.site.urls)), )