Ejemplo n.º 1
0
    def post(self):
        the_post = Post()
        username = the_post.get_username(self)
        token = the_post.get_token(self)
        name = the_post.get_name(self)
        im_user_id = the_post.get_id(self)
        submit = the_post.get_submit(self)
        delete_or_restore = the_post.get_delete_or_restore(self)

        detail_url = IM_USER_DETAIL_URL + "?id=" + im_user_id

        ohho_user_instance = OHHOUser(username)
        im_user_instance = IMUser()

        user = ohho_user_instance.get_user()
        im_user = im_user_instance.get_by_id(im_user_id)

        # if submit and im_user and user:
        #     data = dict()
        #     data["account_id"] = user.id
        #     data["token"] = token
        #     data["name"] = name
        #     success = im_user_instance.update(im_user, data)
        #     if success:
        #         return self.redirect(IM_USER_LIST_URL)
        if delete_or_restore and im_user:
            if im_user.state is True:
                success = im_user_instance.delete(im_user)
            else:
                success = im_user_instance.restore(im_user)
            if success:
                return self.redirect(IM_USER_LIST_URL)
        return self.redirect(detail_url)
Ejemplo n.º 2
0
    def post(self):
        the_post = Post()
        user_id = the_post.get_user_id(self)
        submit = the_post.get_submit(self)
        delete_or_restore = the_post.get_delete_or_restore(self)

        instance = User()
        user = instance.get_by_id(user_id)

        delete_url = MANAGEMENT_USER_DELETE_URL + "?user_id=" + str(user_id)
        if delete_or_restore and user:
            if user.state:
                success = instance.delete(user)
            else:
                success = instance.restore(user)
            if success:
                return self.redirect(MANAGEMENT_USER_LIST_URL)
            else:
                return self.redirect(delete_url)
        if submit:
            user_extension = the_post.get_user_extension(self)
            user_extension_instance = DBOHHOUserAccuracyExtension()
            user_extension_object = user_extension_instance.get_by_user(
                user_id)
            success = user_extension_instance.update(user_extension_object,
                                                     user_extension)
            if success:
                return self.redirect(MANAGEMENT_USER_LIST_URL)
            else:
                return self.redirect(delete_url)
        return self.redirect(delete_url)
Ejemplo n.º 3
0
 def post(self):
     the_post = Post()
     sensitive_id = the_post.get_id(self)
     delete_or_restore = the_post.get_delete_or_restore(self)
     instance = SensitiveBackstage()
     sensitive_object = instance.get_by_id(sensitive_id)
     if delete_or_restore and sensitive_object:
         success = instance.delete(sensitive_object)
         if success:
             return self.redirect(BASE_SENSITIVE_BACKSTAGE_LIST_URL)
     return self.redirect(BASE_SENSITIVE_BACKSTAGE_DELETE_HTML + "?id=" + str(sensitive_id))
Ejemplo n.º 4
0
    def post(self):
        the_post = Post()
        page_id = the_post.get_id(self)
        instance = OHHOPermission()
        page_obj = instance.page.get_by_id(page_id)
        delete_or_restore = the_post.get_delete_or_restore(self)
        success = False
        if delete_or_restore:
            success = instance.page.delete(page_obj)

        if success:
            return self.redirect(PERMISSION_PAGE_BACKSTAGE_LIST_URL)
        return self.redirect(PERMISSION_PAGE_BACKSTAGE_DETAIL_URL + "?id=" + str(page_id))
Ejemplo n.º 5
0
 def post(self):
     the_post = Post()
     country_code_id = the_post.get_id(self)
     instance = CountryCode()
     country_code_obj = instance.get(country_code_id)
     delete_or_restore = the_post.get_delete_or_restore(self)
     success = False
     if delete_or_restore:
         success = instance.delete(country_code_obj)
     if success:
         return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL)
     return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_DELETE_HTML + "?id=" +
                          str(country_code_id))
Ejemplo n.º 6
0
    def post(self):
        the_post = Post()

        group_id = the_post.get_id(self)
        instance = OHHOPermission()
        group_obj = instance.group.get_by_id(group_id)
        delete_or_restore = the_post.get_delete_or_restore(self)
        success = False
        if delete_or_restore:
            success = instance.group.delete(group_obj)
        if success:
            return self.redirect(PERMISSION_GROUP_BACKSTAGE_LIST_URL)
        return self.redirect(PERMISSION_GROUP_BACKSTAGE_DELETE_URL + "?id=" +
                             str(group_id))
Ejemplo n.º 7
0
    def post(self):
        the_post = Post()
        staff_id = the_post.get_staff_id(self)
        delete_or_restore = the_post.get_delete_or_restore(self)

        instance = Staff()
        staff = instance.get_by_id(staff_id)

        delete_url = MANAGEMENT_STAFF_DELETE_URL + "?staff_id=" + str(staff_id)
        if delete_or_restore and staff:
            if staff.state:
                success = instance.delete(staff)
            else:
                success = instance.restore(staff)
            if success:
                return self.redirect(MANAGEMENT_STAFF_LIST_URL)
            else:
                return self.redirect(delete_url)

        return self.redirect(delete_url)
Ejemplo n.º 8
0
    def post(self):
        the_post = Post()
        drink_id = the_post.get_id(self)
        name = the_post.get_name(self)
        instance = Drink()
        drink = instance.get(drink_id)
        submit = the_post.get_submit(self)
        delete_or_restore = the_post.get_delete_or_restore(self)
        success = False
        if submit:
            data = dict()
            data["name"] = name
            success = instance.update(drink, data)
        if delete_or_restore:
            if drink.state:
                success = instance.delete(drink)
            else:
                success = instance.restore(drink)

        if success:
            return self.redirect(BASE_DRINK_LIST_URL)
        return self.redirect(BASE_DRINK_DETAIL_HTML + "?id=" + str(drink_id))
Ejemplo n.º 9
0
    def post(self):
        the_post = Post()
        country_code_id = the_post.get_id(self)
        country_name = the_post.get_name(self)
        country_code = the_post.get_country_code(self)
        instance = CountryCode()
        country_code_obj = instance.get(country_code_id)
        submit = the_post.get_submit(self)
        delete_or_restore = the_post.get_delete_or_restore(self)
        success = False
        if submit:
            data = dict()
            data["country_name"] = country_name
            data["country_code"] = country_code
            success = instance.update(country_code_obj, data)
        if delete_or_restore:
            success = instance.delete(country_code_obj)

        if success:
            return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL)
        return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_HTML + "?id=" +
                             str(country_code_id))
Ejemplo n.º 10
0
    def post(self):
        the_post = Post()
        username = the_post.get_username(self)
        identity_id = the_post.get_device_identity_id(self)
        user_instance = DBOHHOUser()
        device_instance = DBOHHODevice()
        relation_instance = DBOHHOUserAndDeviceRelation()

        user = user_instance.get_by_username(username)
        device_instance.set_identity(identity_id)
        device = device_instance.get_by_identity()
        delete_or_restore = the_post.get_delete_or_restore(self)
        if delete_or_restore:
            if device:
                relation = relation_instance.get_by_device(device.id)
                if relation:
                    if relation.state:
                        # print("execute delete")
                        relation_instance.delete(relation)
                    else:
                        # print("execute restore")
                        relation_instance.restore(relation)

        return self.redirect(USER_AND_DEVICE_LIST_URL)
Ejemplo n.º 11
0
    def post(self):
        data = dict()
        instance = UserDisplayConfiguration()
        the_post = Post()
        distance = the_post.get_distance(self)
        has_sex = the_post.get_has_sex(self)
        has_identity_card = the_post.get_has_identity_card(self)
        has_real_name = the_post.get_has_real_name(self)
        has_email = the_post.get_has_email(self)
        has_icon = the_post.get_has_icon(self)
        has_source_icon = the_post.get_has_source_icon(self)
        has_nickname = the_post.get_has_nickname(self)
        has_birthday = the_post.get_has_birthday(self)
        has_height = the_post.get_has_height(self)
        has_weight = the_post.get_has_weight(self)
        has_marriage = the_post.get_has_marriage(self)
        has_resume = the_post.get_has_resume(self)
        has_blood = the_post.get_has_blood(self)
        has_hometown = the_post.get_has_hometown(self)
        has_current = the_post.get_has_current(self)
        has_industry_id = the_post.get_has_industry_id(self)
        has_body_type_id = the_post.get_has_body_type_id(self)
        has_smoke_id = the_post.get_has_smoke_id(self)
        has_drink_id = the_post.get_has_drink_id(self)
        has_work_domain_id = the_post.get_has_work_domain_id(self)
        has_profession_id = the_post.get_has_profession_id(self)
        has_school = the_post.get_has_school(self)
        has_company = the_post.get_has_company(self)
        has_education = the_post.get_has_education(self)
        has_interest = the_post.get_has_interest(self)
        data["distance"] = distance
        data["has_sex"] = has_sex
        data["has_identity_card"] = has_identity_card
        data["has_real_name"] = has_real_name
        data["has_email"] = has_email
        data["has_icon"] = has_icon
        data["has_source_icon"] = has_source_icon
        data["has_nickname"] = has_nickname
        data["has_birthday"] = has_birthday
        data["has_height"] = has_height
        data["has_weight"] = has_weight
        data["has_marriage"] = has_marriage
        data["has_resume"] = has_resume
        data["has_blood"] = has_blood
        data["has_hometown"] = has_hometown
        data["has_current"] = has_current
        data["has_industry_id"] = has_industry_id
        data["has_body_type_id"] = has_body_type_id
        data["has_smoke_id"] = has_smoke_id
        data["has_drink_id"] = has_drink_id
        data["has_work_domain_id"] = has_work_domain_id
        data["has_profession_id"] = has_profession_id
        data["has_school"] = has_school
        data["has_company"] = has_company
        data["has_education"] = has_education
        data["has_interest"] = has_interest
        user_display_config_id = the_post.get_id(self)
        user_display_config_obj = instance.get(user_display_config_id)
        submit = the_post.get_submit(self)
        delete_or_retore = the_post.get_delete_or_restore(self)
        success = False
        if submit:
            success = instance.update(user_display_config_obj, data)

        if delete_or_retore:
            if user_display_config_obj.id:
                success = instance.delete(user_display_config_obj)
        if success:
            return self.redirect(BASE_USER_DISPLAY_CONFIG_LIST_URL)
        return self.redirect(BASE_USER_DISPLAY_CONFIG_DETAIL_HTML + "?id=" +
                             str(user_display_config_id))