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
 
@@ -42,8 +42,8 @@ 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+)?)\)$')
 

	
 
@@ -528,8 +528,29 @@ class Department(Base):
 
    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):
0 comments (0 inline, 0 general)