def device_list(product): device_types = product.device_types if device_types: t = env.get_template('detail/helpers/device_list.html') return jinja2.Markup(t.render({ 'device_types': device_types, 'all_device_types': DEVICE_TYPES.values()}))
def device_list(product): device_types = product.device_types if device_types: t = env.get_template('detail/helpers/device_list.html') return jinja2.Markup( t.render({ 'device_types': device_types, 'all_device_types': DEVICE_TYPES.values() }))
def _step(self): self.user.update(read_dev_agreement=datetime.datetime.now()) self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp, terms=True, manifest=True) # Associate app with user. AddonUser.objects.create(addon=self.webapp, user=self.user) # Associate device type with app. self.dtype = DEVICE_TYPES.values()[0] AddonDeviceType.objects.create(addon=self.webapp, device_type=self.dtype.id) self.device_types = [self.dtype] # Associate category with app. self.cat1 = Category.objects.create(type=amo.ADDON_WEBAPP, name="Fun") AddonCategory.objects.create(addon=self.webapp, category=self.cat1)
def _step(self): self.user.update(read_dev_agreement=datetime.datetime.now()) self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp, terms=True, manifest=True) # Associate app with user. AddonUser.objects.create(addon=self.webapp, user=self.user) # Associate device type with app. self.dtype = DEVICE_TYPES.values()[0] AddonDeviceType.objects.create(addon=self.webapp, device_type=self.dtype.id) # Associate category with app. self.cat1 = Category.objects.create(type=amo.ADDON_WEBAPP, name='Fun') AddonCategory.objects.create(addon=self.webapp, category=self.cat1)
def _step(self): #self.user.update(read_dev_agreement=datetime.datetime.now()) self.user.update(read_dev_agreement=True) self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp, terms=True, manifest=True) # Associate app with user. AddonUser.objects.create(addon=self.webapp, user=self.user) # Associate device type with app. self.dtype = DEVICE_TYPES.values()[0] AddonDeviceType.objects.create(addon=self.webapp, device_type=self.dtype.id) # Associate category with app. self.cat1 = Category.objects.create(type=amo.ADDON_WEBAPP, name='Fun') AddonCategory.objects.create(addon=self.webapp, category=self.cat1) # Create initial formset for categories. ctx = self.client.get(self.url).context['form_cats'] self.cat_initial = amo.tests.initial(ctx.initial_forms[0])
def devices(self, data): with no_translation(): names = dict([(n.api_name, n.id) for n in DEVICE_TYPES.values()]) filtered = [names.get(n, n) for n in data.get('device_types', [])] return {'device_types': filtered}