Exemplo n.º 1
0
    def post(self):
        tdc = TestDataCreationHandler()
        tdc.create_member(self['owner_email'], self['owner_name'], self['owner_phone'], 'owner')
        tdc.create_member(self['manager_email'], self['manager_name'], self['manager_phone'], 'manager')

        store_obj = Store()
        store_obj.name = self['store_name']
        store_obj.owner = self['owner_email']
        store_obj.manager = self['manager_email']
        store_obj.location = db.GeoPt(self['store_lat'],self['store_long'])
        store_obj.address = " ".join(self['store_address'].split("\n"))
        store_obj.billing_address = " ".join(self['store_billing_address'].split("\n"))
        store_obj.put()

        appliances_csv = self['appliances_csv']
        appliances = appliances_csv.splitlines()
        appliance_index = [index.strip("\"") for index in str(appliances[0]).split(',')]
        for appliance in appliances[1:]:
            appliance = [detail.strip("\"") for detail in str(appliance).split(',')]
            appliance_obj = Appliance()
            appliance_obj.name = appliance[appliance_index.index("Name of Appliance")]
            appliance_obj.serial_num = appliance[appliance_index.index("Serial #")]
            appliance_obj.model = appliance[appliance_index.index("Model #")]
            appliance_obj.manufacturer = appliance[appliance_index.index("Manufacturer Name")]
            appliance_obj.last_repair_date = self.get_appliance_form_date("Last Repair Date (if you know it)", appliance, appliance_index)
            appliance_obj.installed_on = self.get_appliance_form_date("Installed on (if known)", appliance, appliance_index)
            appliance_obj.warranty = self.get_appliance_form_date("Is it in warranty (if known)", appliance, appliance_index)
            appliance_obj.store = store_obj
            appliance_obj.put()
Exemplo n.º 2
0
 def post(self):
     loc = self['location'].split(',')
     store = Store()
     store.name = self['name']
     store.location = db.GeoPt(loc[0], loc[1])
     store.manager = self['manager']
     store.owner = self['owner']
     store.put()
Exemplo n.º 3
0
 def get(self):
     store = get_store()
     if store is None:
         store = Store(key_name=STORE_KEY,
                             name='My Store',
                             description='This is my store',
                             declaration='Write your declaration')
         store.put()
         memcache.delete(STORE_KEY)
         memcache.set(STORE_KEY, store)
     self.redirect('/store')
Exemplo n.º 4
0
def store_mapper(member, role_name):
    fields = member['fields']
    store_obj = Store.all().filter('airtable_id =', fields['Store ID']).get()
    if not store_obj:
        store_obj = Store()
    store_obj.name = fields['Store Name']
    store_obj.location = db.GeoPt(fields['Latitude'],fields['Longitude'])
    store_obj.address = fields['Store Address']
    store_obj.billing_address = fields['Billing Address']
    store_obj.owner = obj_map[fields['Store Owner'][0]].key().name()
    store_obj.manager = obj_map[fields['Store Manager'][0]].key().name()
    store_obj.airtable_id = fields['Store ID']
    store_obj.put()
    obj_map[member['id']] = store_obj
Exemplo n.º 5
0
 def create_stores(self, manager2, manager, owner):
     stores = []
     store = Store(name="McDonald's", location=db.GeoPt(40.7131116,-74.015359), manager=manager2.key().name(), owner=owner.key().name(), address="McDonald's, Logn Gate Shopping Center, 4396 Montgomery Rd, Ellicott City, MD 21043", billing_address="Brdancat Enterprises, Inc., 9107 Mendenhall Ct., Unit B, Columbia, MD 21045")
     store.put()
     stores.append(store)
     store = Store(name="Starbucks", location=db.GeoPt(40.7131116,-83.015359), manager=manager.key().name(), owner=owner.key().name(), address="Starbucks, Shrt Gate Shopping Center, 6392 Gregory Rd, Kingston City, NV 52552", billing_address="Fieldcat Enterprises, Inc., 1822 Radcliffe St., Unit B, Durby, DL 62611")
     store.put()
     stores.append(store)
     store = Store(name="Friendly's", location=db.GeoPt(37.7131116,-96.015359), manager=manager.key().name(), owner=owner.key().name(), address="Friendly's, North Wall Shopping Center, 4319 Desmond St, Riverside, CA 92503", billing_address="Redwood Services, Inc., 6777 Brook Av., Lansing, PA 48912")
     store.put()
     stores.append(store)
     store = Store(name="Hardrock Cafe", location=db.GeoPt(41.4291638,-76.215929), manager=manager.key().name(), owner=owner.key().name(), address="Hardrock Cafe, 100 Broadway, New York City, NY 10001", billing_address="Rose Inc., 4193 Manning Dr., Richmond, VA 23420")
     store.put()
     stores.append(store)
     store = Store(name="Tavern", location=db.GeoPt(40.6192436,-77.819237), manager=manager.key().name(), owner=owner.key().name(), address="Tavern, 297 Clark St., Chicago, IL 60604", billing_address="The Billers, 78 University Rd., Syracuse, NY 13205")
     store.put()
     stores.append(store)
     return stores