def delete_charge_type_post(id): item = api.get(ChargeType, id) if not item: Alert.bad(api.error) return redirect("/chargetypes/") deleted = api.delete(ChargeType, item) if not deleted: Alert.bad(api.error) return redirect("/chargetypes/{}/".format(id)) Alert.good("Deleted <strong>Charge Type</strong> '{}'".format(item.name)) return redirect("/chargetypes/")
def delete_event_role_post(id): item = api.get(EventRole, id) if not item: Alert.bad(api.error) return redirect("/eventroles/") deleted = api.delete(EventRole, item) if not deleted: Alert.bad(api.error) return redirect("/eventroles/{}/".format(id)) Alert.good("Deleted <strong>Event Role</strong> '{}'".format(item.name)) return redirect("/eventroles/")
def delete_location_post(id): item = api.get(EventLocation, id) if not item: Alert.bad(api.error) return redirect("/locations/") deleted = api.delete(EventLocation, item) if not deleted: Alert.bad(api.error) return redirect("/locations/{}/".format(id)) Alert.good("Deleted <strong>Location</strong> '{}'".format(item.name)) return redirect("/locations/")
def delete_user_post(id): item = api.get(User, id) if not item: Alert.bad(api.error) return redirect("/users/") deleted = api.delete(User, item) if not deleted: Alert.bad(api.error) return redirect("/users/{}/".format(id)) Alert.good("Deleted <strong>User</strong> '{}'".format(item.name)) return redirect("/users/")
def delete_partnership_post(id): item = api.get(Partnership, id) if not item: Alert.bad(api.error) return redirect("/partnerships/") deleted = api.delete(Partnership, item) if not deleted: Alert.bad(api.error) return redirect("/partnerships/{}/".format(id)) Alert.good("Deleted <strong>Partnership</strong> '{}'".format(item.name)) return redirect("/partnerships/")
def delete_weather_post(id): item = api.get(WeatherCondition, id) if not item: Alert.bad(api.error) return redirect("/weather/") deleted = api.delete(WeatherCondition, item) if not deleted: Alert.bad(api.error) return redirect("/weather/{}/".format(id)) Alert.good("Deleted <strong>Weather Condition</strong> '{}'".format( item.name)) return redirect("/weather/")