Advertisement
aldak

Ladon complex types

Feb 1st, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.30 KB | None | 0 0
  1. class Customer(LadonType):
  2.    
  3.     ID = {
  4.           'type' : int,
  5.           'nullable' : True,
  6.           'default' : None,
  7.           'doc' : "Customer's ID"
  8.           }
  9.     LegalForm = {
  10.                  'type' : int,
  11.                  'nullable' : False,
  12.                  'doc' : "0 - Company, 1 - Person"
  13.                  }
  14.     CompanyName = {
  15.                    'type' : PORTABLE_STRING,
  16.                    'nullable' : True,
  17.                    'doc' : "Name of company"
  18.                    }
  19.     DegreeBefore = {
  20.                     'type' : PORTABLE_STRING,
  21.                     'nullable' : True,
  22.                     'doc' : "Degree before name of person"
  23.                     }
  24.     FirstName = {
  25.                  'type' : PORTABLE_STRING,
  26.                  'nullable' : True,
  27.                  'doc' : "First name of person"
  28.                  }
  29.     LastName = {
  30.                 'type' :PORTABLE_STRING,
  31.                 'nullable' : True,
  32.                 'doc' : "Last name of person"
  33.                 }
  34.     DegreeAfter = {
  35.                    'type' : PORTABLE_STRING,
  36.                    'nullable' : True,
  37.                    'doc' : "Degree after name of person"
  38.                    }
  39.     CompanyID = {
  40.                  'type' : PORTABLE_STRING,
  41.                  'nullable' : True,
  42.                  'doc' : "ID of comapny"
  43.                  }
  44.     VAT = {
  45.            'type' : PORTABLE_STRING,
  46.            'nullable' : True,
  47.            'doc' : "VAT ID"
  48.            }
  49.     BankAccount = {
  50.                    'type' :PORTABLE_STRING,
  51.                    'nullable' : True,
  52.                    'doc' : "Bank account of customer"
  53.                    }
  54.     InvoiceTogether = {
  55.                        'type' :bool,
  56.                        'nullable' : False,
  57.                        'default' : True,
  58.                        'doc' : "TRUE - all invoices bundle together, FALSE - issue invoices separately"
  59.                        }
  60.     Author = {
  61.               'type' : PORTABLE_STRING,
  62.               'nullable' : False,
  63.               'doc' : "Name of record author"
  64.               }
  65.     CreationIP = {
  66.                   'type' : PORTABLE_STRING,
  67.                   'nullable' : False,
  68.                   'doc' : "IP of record author"
  69.                   }
  70.     CreationDate = {
  71.                     'type' : PORTABLE_STRING,
  72.                     'nullable' : False,
  73.                     'doc' : "Datetime of creation record"
  74.                     }
  75.     ChangedBy = {
  76.                  'type' : PORTABLE_STRING,
  77.                  'nullable' : True,
  78.                  'doc' : "Last chage author's name"
  79.                  }
  80.     ChangeIP = {
  81.                 'type' : PORTABLE_STRING,
  82.                 'nullable' : True,
  83.                 'doc' : "Last change done from IP"
  84.                 }
  85.     ChangeDate = {
  86.                   'type' : PORTABLE_STRING,
  87.                   'nullable' : True,
  88.                   'doc' : "Datetime of last change"
  89.                   }
  90.    
  91.     contacts = [Contact]
  92.  
  93. class Contact(LadonType):
  94.     '''
  95.    DTO for Contact
  96.    '''
  97.    
  98.     ID = {
  99.           'type' : int,
  100.           'nullable' : True,
  101.           'doc' : "ID of contact"
  102.           }
  103.     IDType = {
  104.               'type' : int,
  105.               'nullable' : False,
  106.               'doc' : "ID of contact type"
  107.               }
  108.     #IDContactPerson = Column(Integer, ForeignKey('ContactPerson.ID'))
  109.     IDCustomer = {
  110.                   'type' : int,
  111.                   'nullable' : True,
  112.                   'doc' : "ID of customer"
  113.                   }
  114.     Default = {
  115.                'type' : bool,
  116.                'nullable' : False,
  117.                'doc' : "Default contact. Only one contact of ContactPerson or Customer is set as default."
  118.                }
  119.     Connection = {
  120.                   'type' : PORTABLE_STRING,
  121.                   'nullable' : False,
  122.                   'doc' : "Value of the contact (phone, email, fax etc.)"
  123.                   }
  124.     Author = {
  125.               'type' : PORTABLE_STRING,
  126.               'nullable' : False,
  127.               'doc' : "Name of record author"
  128.               }
  129.     CreationIP = {
  130.                   'type' : PORTABLE_STRING,
  131.                   'nullable' : False,
  132.                   'doc' : "IP of record author"
  133.                   }
  134.     CreationDate = {
  135.                     'type' : PORTABLE_STRING,
  136.                     'nullable' : False,
  137.                     'doc' : "Datetime of creation record"
  138.                     }
  139.     ChangedBy = {
  140.                  'type' : PORTABLE_STRING,
  141.                  'nullable' : True,
  142.                  'doc' : "Last chage author's name"
  143.                  }
  144.     ChangeIP = {
  145.                 'type' : PORTABLE_STRING,
  146.                 'nullable' : True,
  147.                 'doc' : "Last change done from IP"
  148.                 }
  149.     ChangeDate = {
  150.                   'type' : PORTABLE_STRING,
  151.                   'nullable' : True,
  152.                   'doc' : "Datetime of last change"
  153.                   }
  154.    
  155.     contactType = ContactType
  156.  
  157. class ContactType(LadonType):
  158.     '''
  159.    DTO for ContactType
  160.    '''
  161.  
  162.     ID = {
  163.           'type' : int,
  164.           'nullable' : True,
  165.           'doc' : "ID of contact type"
  166.           }
  167.     Name = {
  168.             'type' : PORTABLE_STRING,
  169.             'nullable' : True,
  170.             'doc' : "Name of contact type"
  171.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement