def save_platforms(self, obj, new): new_platforms = [mkt.PLATFORM_LOOKUP[p].id for p in new] old_platforms = [x.id for x in obj.platforms] added_platforms = set(new_platforms) - set(old_platforms) removed_platforms = set(old_platforms) - set(new_platforms) for p in added_platforms: obj.platform_set.create(platform_id=p) obj.platform_set.filter(platform_id__in=removed_platforms).delete() # Send app to re-review queue if public and new platforms are added. if added_platforms and obj.status in amo.WEBAPPS_APPROVED_STATUSES: mark_for_rereview(obj, added_platforms, removed_platforms)
def save_device_types(self, obj, new_types): new_types = [amo.DEVICE_LOOKUP[d].id for d in new_types] old_types = [x.id for x in obj.device_types] added_devices = set(new_types) - set(old_types) removed_devices = set(old_types) - set(new_types) for d in added_devices: obj.addondevicetype_set.create(device_type=d) for d in removed_devices: obj.addondevicetype_set.filter(device_type=d).delete() # Send app to re-review queue if public and new devices are added. if added_devices and obj.status in amo.WEBAPPS_APPROVED_STATUSES: mark_for_rereview(obj, added_devices, removed_devices)
def save(self, addon): new_types = self.cleaned_data['device_types'] old_types = [x.id for x in addon.device_types] added_devices = set(new_types) - set(old_types) removed_devices = set(old_types) - set(new_types) for d in added_devices: addon.addondevicetype_set.create(device_type=d) for d in removed_devices: addon.addondevicetype_set.filter(device_type=d).delete() # Send app to re-review queue if public and new devices are added. if added_devices and self.addon.status == amo.STATUS_PUBLIC: mark_for_rereview(self.addon, added_devices, removed_devices)
def save(self, addon): new_types = self.cleaned_data['device_types'] old_types = [x.id for x in addon.device_types] added_devices = set(new_types) - set(old_types) removed_devices = set(old_types) - set(new_types) for d in added_devices: addon.addondevicetype_set.create(device_type=d) for d in removed_devices: addon.addondevicetype_set.filter(device_type=d).delete() # Send app to re-review queue if public and new devices are added. if added_devices and self.addon.status in amo.WEBAPPS_APPROVED_STATUSES: mark_for_rereview(self.addon, added_devices, removed_devices)