コード例 #1
0
ファイル: manager.py プロジェクト: weixiyen/Rentfox
 def get_managers_of_property(propertyid):
     records = Property_manager.get_records_with_propertyid(propertyid)
     manager_list = []
     for record in records:
         if not Manager.is_admin(record.manager_id):
             manager = meta.Session.query(Manager).filter_by(id=record.manager_id).first()
             manager_list.append(manager.id)
     return manager_list
コード例 #2
0
ファイル: property.py プロジェクト: weixiyen/Rentfox
 def create(**kwargs):
     from rentfox.model.pulse import Pulse
     
     property = Property()
     
     for key in kwargs:
         property.__setattr__(key, kwargs[key])
     
     meta.Session.add(property)
     meta.Session.commit()
     session.save()
     
     Property_manager.create(
         id = str(uuid.uuid1()),
         property_id = kwargs['id'],
         manager_id = Manager.get_id_of_username(request.environ.get('REMOTE_USER'))
     )
     
     Pulse.create(
                  propertyid = property.id,
                  type = 'property',
                  html = '<div class="unit"><a href="/property/view/{0}">{1}</a> was created.</div>'.format(
                             property.id,
                             property.name
                             )
                  )
     
     # index for searching later
     type = 'property'
     id = property.id
     text = ' '.join([property.name, property.name, property.address, property.city, property.zip])
             
     terms = [
              {'type':'company', 'id':request.environ.get('COMPANY_ID')},
              {'type':'property', 'id':id}
              ]
     index = Index()
     index.index(type, id, text, terms)