Changeset - 41aceb8076db
[Not reviewed]
0 1 0
Lance Edgar (lance) - 12 years ago 2012-07-31 12:55:14
lance@edbob.org
add Subdepartment class
1 file changed with 25 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rattail/db/extension/model.py
Show inline comments
 
@@ -39,14 +39,14 @@ import edbob
 
from edbob.db.model import Base, uuid_column
 
from edbob.db.extensions.auth import Person
 

	
 

	
 
__all__ = ['SilColumn', 'BatchDictionaryColumn', 'BatchDictionary',
 
           'BatchTerminalColumn', 'BatchTerminal', 'BatchColumn',
 
           'Batch', 'Brand', 'Department', 'Category', 'Product',
 
           'Employee']
 
           'Batch', 'Brand', 'Department', 'Subdepartment', 'Category',
 
           'Product', 'Employee']
 

	
 
sil_type_pattern = re.compile(r'^(CHAR|NUMBER)\((\d+(?:\,\d+)?)\)$')
 

	
 

	
 
class SilColumn(Base):
 
    """
 
@@ -525,14 +525,35 @@ class Department(Base):
 
    number = Column(Integer)
 
    name = Column(String(30))
 

	
 
    def __repr__(self):
 
        return "<Department: %s>" % self.name
 

	
 
    def __str__(self):
 
        return str(self.name or '')
 
    def __unicode__(self):
 
        return unicode(self.name or '')
 

	
 

	
 
class Subdepartment(Base):
 
    """
 
    Represents an organizational subdepartment.
 
    """
 

	
 
    __tablename__ = 'subdepartments'
 

	
 
    uuid = uuid_column()
 
    number = Column(Integer)
 
    name = Column(String(30))
 
    department_uuid = Column(String(32), ForeignKey('departments.uuid'))
 

	
 
    department = relationship(Department)
 

	
 
    def __repr__(self):
 
        return "<Subdepartment: %s>" % self.name
 

	
 
    def __unicode__(self):
 
        return unicode(self.name or '')
 

	
 

	
 
class Category(Base):
 
    """
 
    Represents an organizational category for products.
 
    """
0 comments (0 inline, 0 general)