示例#1
0
def restore_charge_type(id):
    item = api.get(ChargeType, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/chargetypes/")

    restored = api.restore(ChargeType, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/chargetypes/")

    Alert.good("Restored <strong>Charge Type</strong> with name <strong>{}</strong>".format(item.name))
    return redirect("/chargetypes/")
示例#2
0
def restore_event(id):
    item = api.get(Event, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/events/")

    restored = api.restore(Event, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/events/")

    Alert.good("Restored <strong>Event</strong> with name <strong>{}</strong>".format(item.name))
    return redirect("/events/")
示例#3
0
def restore_partnership(id):
    item = api.get(Partnership, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/partnerships/")

    restored = api.restore(Partnership, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/partnerships/")

    Alert.good("Restored <strong>Partnership</strong> with name <strong>{}</strong>".format(item.name))
    return redirect("/partnerships/")
示例#4
0
def restore_location(id):
    item = api.get(EventLocation, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/locations/")

    restored = api.restore(EventLocation, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/locations/")

    Alert.good("Restored <strong>Location</strong> with name <strong>{}</strong>".format(item.name))
    return redirect("/locations/")
示例#5
0
def restore_weather(id):
    item = api.get(WeatherCondition, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/weather/")

    restored = api.restore(WeatherCondition, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/weather/")

    Alert.good(
        "Restored <strong>Weather Condition</strong> with name <strong>{}</strong>"
        .format(item.name))
    return redirect("/weather/")
示例#6
0
文件: user.py 项目: jack0x539/cycleng
def restore_user(id):
    item = api.get(User, id)

    if not item:
        Alert.bad(api.error)
        return redirect("/users/")

    restored = api.restore(User, item)

    if not restored:
        Alert.bad(api.error)
        return redirect("/users/")

    Alert.good(
        "Restored <strong>User</strong> with name <strong>{}</strong>".format(
            item.name))
    return redirect("/users/")