Pārlūkot izejas kodu

Updated models so syncdb will run but everything still imcomplete

master
David Winterbottom 15 gadus atpakaļ
vecāks
revīzija
949ee4c09d
9 mainītis faili ar 81 papildinājumiem un 23 dzēšanām
  1. 1
    0
      IDEAS
  2. 12
    0
      README.md
  3. 28
    2
      basket/models.py
  4. 7
    1
      offer/models.py
  5. 14
    13
      order/models.py
  6. 3
    1
      payment/models.py
  7. 3
    1
      product/models.py
  8. 2
    1
      requirements.txt
  9. 11
    4
      settings.py

+ 1
- 0
IDEAS Parādīt failu

@@ -0,0 +1 @@
1
+Record ideas about the project here...

+ 12
- 0
README.md Parādīt failu

@@ -0,0 +1,12 @@
1
+# Oscar - Ecommerce on Django
2
+
3
+Named after Oscar Peterson (http://en.wikipedia.org/wiki/Oscar_Peterson), oscar is a Django implementation
4
+of Taoshop (a product from Tangent Labs).  It's fairly experimental at the moment.
5
+
6
+## Installation
7
+Do the following from your workspace folder:
8
+    mkdir oscar
9
+	cd oscar
10
+    mkvirtualenv --no-site-packages oscar
11
+After download your fork, install all dependencies:
12
+	pip install -r requirements.txt

+ 28
- 2
basket/models.py Parādīt failu

@@ -1,6 +1,32 @@
1
+from django.contrib.auth.models import User
1 2
 from django.db import models
3
+from django.utils.translation import ugettext as _
2 4
 
3 5
 
4 6
 class Basket(models.Model):
5
-    owner = models.ForeignKey('auth.User')
6
-    status = models.CharField(max_length)
7
+    """
8
+    Main basket object
9
+    """
10
+    OPEN, MERGED, SUBMITTED = ("Open", "Merged", "Submitted")
11
+    STATUS_CHOICES = (
12
+        (OPEN, _("Open - currently active")),
13
+        (APPROVED, _("Merged - superceded by another basket")),
14
+        (REJECTED, _("Submitted - has been ordered at the checkout")),
15
+    )
16
+    
17
+    owner = models.ForeignKey(User, related_name='baskets')
18
+    status = models.CharField(default=OPEN, choices=STATUS_CHOICES)
19
+    created_date = models.DateTimeField(auto_now_add=True)
20
+    
21
+    
22
+class Line(models.Model):
23
+    basket = models.ForeignKey('basket.Basket', related_name='lines')
24
+    product = models.ForeignKey('product.Item')
25
+    vouchers = models.ManyToManyField('offer.Voucher')
26
+    
27
+    
28
+class LineAttribute(models.Model):
29
+    line = models.ForeignKey('basket.Line', related_name='attributes')
30
+    type = models.CharField(max_length=128)
31
+    value = models.CharField(max_length=255)    
32
+    

+ 7
- 1
offer/models.py Parādīt failu

@@ -1,3 +1,9 @@
1
+from django.contrib.auth.models import User
1 2
 from django.db import models
3
+from django.utils.translation import ugettext as _
2 4
 
3
-# Create your models here.
5
+class Voucher(models.Model):
6
+    code = models.CharField(max_length=128)
7
+    start_date = models.DateField()
8
+    end_date = models.DateField()
9
+    created_date = models.DateTimeField(auto_now_add=True)

+ 14
- 13
order/models.py Parādīt failu

@@ -1,11 +1,12 @@
1 1
 from django.db import models
2
-from django.contrib.auth import User
2
+from django.contrib.auth.models import User
3 3
 
4 4
 class Order(models.Model):
5 5
     """
6 6
     An order
7 7
     """
8 8
     customer = models.ForeignKey(User, related_name='orders')
9
+    total_incl_tax = models.FloatField()
9 10
     
10 11
     
11 12
     def __unicode__(self):
@@ -15,16 +16,16 @@ class Order(models.Model):
15 16
         return description
16 17
 
17 18
     
18
-class Batch(models.Model):
19
-    order = models.ForeignKey('order.Order')
20
-    partner = models.CharField(max_length=255)
21
-    delivery_method = models.CharField(max_length=128)
22
-    # Not all batches are actually delivered (such as downloads)
23
-    delivery_address = models.ForeignKey('order.Address', null=True, blank=True)
24
-    # Whether the batch should be dispatched in one go, or as they become available
25
-    dispatch_option = models.CharField(max_length=128, null=True, blank=True)
26
-
27
-
28
-class BatchLine(models.Model):
29
-    batch = models.ForeignKey('order.Batch')
19
+#class Batch(models.Model):
20
+#    order = models.ForeignKey('order.Order')
21
+#    partner = models.CharField(max_length=255)
22
+#    delivery_method = models.CharField(max_length=128)
23
+#    # Not all batches are actually delivered (such as downloads)
24
+#    delivery_address = models.ForeignKey('order.Address', null=True, blank=True)
25
+#    # Whether the batch should be dispatched in one go, or as they become available
26
+#    dispatch_option = models.CharField(max_length=128, null=True, blank=True)
27
+#
28
+#
29
+#class BatchLine(models.Model):
30
+#    batch = models.ForeignKey('order.Batch')
30 31
     

+ 3
- 1
payment/models.py Parādīt failu

@@ -1,4 +1,6 @@
1
+from django.contrib.auth.models import User
1 2
 from django.db import models
3
+from django.utils.translation import ugettext as _
2 4
 
3 5
 
4 6
 class Source(models.Model):
@@ -25,7 +27,7 @@ class Source(models.Model):
25 27
     
26 28
 class Transaction(models.Model):
27 29
     """
28
-    A transaction for payment sources which need a secondary 'transaction' to take the money
30
+    A transaction for payment sources which need a secondary 'transaction' to actually take the money
29 31
     
30 32
     This applies mainly to credit card sources which can be a pre-auth for the money.  A 'complete'
31 33
     needs to be run later to debit the money from the account.

+ 3
- 1
product/models.py Parādīt failu

@@ -1,9 +1,11 @@
1 1
 from django.db import models
2 2
 
3 3
 class Item(models.Model):
4
+    title = models.CharField(max_length=255)
4 5
     pass
5 6
 
6
-class Stock(models.Model):
7
+
8
+class StockRecord(models.Model):
7 9
     product = models.ForeignKey('product.Item')
8 10
     price_excl_tax = models.FloatField()
9 11
     tax = models.FloatField()

+ 2
- 1
requirements.txt Parādīt failu

@@ -1,6 +1,7 @@
1 1
 Django==1.2.3
2 2
 MySQL-python==1.2.3
3 3
 South==0.7.3
4
+django-extensions==0.5
5
+ipython==0.10.1
4 6
 wsgiref==0.1.2
5 7
 yolk==0.4.1
6
-django_extensions==0.5

+ 11
- 4
settings.py Parādīt failu

@@ -89,8 +89,15 @@ INSTALLED_APPS = (
89 89
     'django.contrib.sessions',
90 90
     'django.contrib.sites',
91 91
     'django.contrib.messages',
92
-    # Uncomment the next line to enable the admin:
93
-    # 'django.contrib.admin',
94
-    # Uncomment the next line to enable admin documentation:
95
-    # 'django.contrib.admindocs',
92
+    'django.contrib.admin',
93
+    'django_extensions',
94
+    'south',
95
+    'payment',
96
+    'order',
96 97
 )
98
+
99
+# Local overrides
100
+try:
101
+    from local_settings import *
102
+except ImportError:
103
+    pass

Notiek ielāde…
Atcelt
Saglabāt