def create(**kwargs): tenant = Tenant() for key in kwargs: tenant.__setattr__(key, kwargs[key]) meta.Session.add(tenant) meta.Session.commit() session.save() # index for searching later type = 'tenant' id = tenant.id text = ' '.join([tenant.first_name, tenant.last_name]) terms = [ {'type':'company', 'id':request.environ.get('COMPANY_ID')}, {'type':'tenant', 'id':id} ] index = Index() index.index(type, id, text, terms)
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)
def create(**kwargs): contact = Contact() for key in kwargs: contact.__setattr__(key, kwargs[key]) meta.Session.add(contact) meta.Session.commit() session.save() # index for searching later type = 'contact' id = kwargs['id'] contact_type = Contact_type.get(contact.typeid) text = 'contact {0} {1} {2}'.format(kwargs['label'], str(kwargs['description']), str(contact_type.label)) terms = [ {'type':'company', 'id':request.environ.get('COMPANY_ID')}, {'type':'contact', 'id':id} ] index = Index() index.index(type, id, text, terms)