def post(self):
        devName = self.request.get("deviceName")
        device_query = Device.all().filter("name = ", devName)
        devItem = device_query.fetch(1)[0]

        fwgName = self.request.get("fwgName")
        fw_query = FirmwareGroup.all().filter("name = ", fwgName)
        fwgItem = fw_query.fetch(1)[0]

        releaseNumber = self.request.get("releaseName")
        relQuery = Firmware.all().filter("group = ", fwgItem).filter("version = ", releaseNumber)
        relItem = relQuery.fetch(1)[0]

        installationTime = self.request.get("releaseDate")
        if installationTime.strip().lower() == "now":
            installationTime = None
        else:
            installationTime = datetime.strptime(installationTime, "%Y-%m-%d")

        gUser = users.get_current_user()
        query = User.all().filter("googleUser = ", gUser)
        res = query.fetch(1)
        myUser = res[0]

        udu = UserDeviceUpdates()
        udu.user = myUser
        udu.device = devItem
        udu.release = relItem
        if installationTime:
            udu.updateDatetime = installationTime
        udu.put()
    def post(self):
        userDevice = UserDevices()

        devName = self.request.get("deviceName")
        device_query = Device.all().filter("name = ", devName)
        devItem = device_query.fetch(1)[0]

        fwgName = self.request.get("fwgName")  # firmware group name
        if fwgName.strip().lower() == "--none--":
            fwgItem = None
        else:
            fw_query = FirmwareGroup.all().filter("name = ", fwgName)
            fwgItem = fw_query.fetch(1)[0]

        gUser = users.get_current_user()
        query = User.all().filter("googleUser = ", gUser)
        res = query.fetch(1)
        if res:
            myUser = res[0]
        else:
            myUser = User()
            myUser.googleUser = gUser
            myUser.put()

        userDevice.user = myUser
        userDevice.device = devItem
        userDevice.firmwareGroup = fwgItem

        userDevice.put()
    def post(self):
        devName = self.request.get("deviceName")
        device_query = Device.all().filter("name = ", devName)
        devItem = device_query.fetch(1)[0]

        gUser = users.get_current_user()
        query = User.all().filter("googleUser = "******"user = "******"device = ", devItem)
        item = query.fetch(1)[0]

        fwgName = self.request.get("fwgName")  # firmware group name
        if fwgName.strip().lower() == "--none--":
            fwgItem = None
        else:
            fw_query = FirmwareGroup.all().filter("name = ", fwgName)
            fwgItem = fw_query.fetch(1)[0]

        item.firmwareGroup = fwgItem
        item.put()