Simplify Django organization, add South support.

This commit is contained in:
Michael DeHaan
2013-02-28 19:39:01 -05:00
parent 17bfe1b2e1
commit d444bd0873
62 changed files with 258 additions and 308 deletions

0
acom/main/__init__.py Normal file
View File

BIN
acom/main/__init__.pyc Normal file

Binary file not shown.

View File

@@ -0,0 +1,36 @@
# -*- 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 'Inventory'
db.create_table('inventory', (
('name', self.gf('django.db.models.fields.TextField')()),
('description', self.gf('django.db.models.fields.TextField')()),
('creation_date', self.gf('django.db.models.fields.DateField')()),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('main', ['Inventory'])
def backwards(self, orm):
# Deleting model 'Inventory'
db.delete_table('inventory')
models = {
'main.inventory': {
'Meta': {'object_name': 'Inventory', 'db_table': "'inventory'"},
'creation_date': ('django.db.models.fields.DateField', [], {}),
'description': ('django.db.models.fields.TextField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.TextField', [], {})
}
}
complete_apps = ['main']

View File

Binary file not shown.

21
acom/main/models.py Normal file
View File

@@ -0,0 +1,21 @@
from django.db import models
class CommonModel(models.Model):
''' common model for all object types that have these standard fields '''
class Meta:
abstract = True
name = models.TextField()
description = models.TextField()
creation_date = models.DateField()
db_table = 'inventories'
class Inventory(CommonModel):
class Meta:
db_table = 'inventory'
id = models.AutoField(primary_key=True)

BIN
acom/main/models.pyc Normal file

Binary file not shown.

23
acom/main/tests.py Normal file
View File

@@ -0,0 +1,23 @@
"""
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
"""}

1
acom/main/views.py Normal file
View File

@@ -0,0 +1 @@
# Create your views here.