Changeset 89

Show
Ignore:
Timestamp:
04/03/08 16:36:39 (5 months ago)
Author:
njriley
Message:

Working models.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sucrose/trunk/www/src/sucrose

    • Property svn:ignore set to
      *.pyc
  • sucrose/trunk/www/src/sucrose/machine

    • Property svn:ignore set to
      *.pyc
  • sucrose/trunk/www/src/sucrose/machine/models.py

    r88 r89  
    1 # This is an auto-generated Django model module. 
    2 # You'll have to do the following manually to clean this up: 
    3 #     * Rearrange models' order 
    4 #     * Make sure each model has one field with primary_key=True 
    5 # Feel free to rename the models, but don't rename db_table values or field names. 
    6 # 
    7 # Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]' 
    8 # into your database. 
    9  
    101from django.db import models 
    112 
     
    134    item_id = models.IntegerField(primary_key=True) 
    145    name = models.CharField(max_length=765) 
    15     price = models.DecimalField(4, 2) 
     6    price = models.DecimalField(max_digits=4, decimal_places=2) 
    167    num_consumed = models.IntegerField(null=True, blank=True) 
    178    tray_slot_size = models.CharField(max_length=39) 
     
    2617    protein = models.IntegerField(null=True, blank=True) 
    2718    cholesterol = models.IntegerField(null=True, blank=True) 
     19 
    2820    class Meta: 
    2921        db_table = u'items' 
     22 
     23    def __unicode__(self): 
     24        return '%s @ $%s' % (self.item.name, self.price) 
    3025 
    3126class Trays(models.Model): 
     
    3530    quantity = models.IntegerField() 
    3631    machine = models.CharField(unique=True, max_length=24) 
    37     price = models.DecimalField(4, 2) 
     32    cur_price = models.DecimalField(max_digits=4, decimal_places=2) 
     33 
    3834    class Meta: 
    3935        db_table = u'trays' 
    4036 
     37    def __unicode__(self): 
     38        return '%s tray %d: %d %s @ $%s' % ( 
     39            self.machine, self.machine_tray_id, self.quantity, 
     40            (self.item and self.item.name), self.cur_price) 
  • sucrose/trunk/www/src/sucrose/settings.py

    r88 r89  
    7878    'django.contrib.sessions', 
    7979    'django.contrib.sites', 
     80    'sucrose.machine', 
    8081)