def execute(self, gauge_ids, nhn_river_id, **kwargs): # All wps processes are required to convert the str representation # of their input parameters to the correct python type for execution try: gauge_ids = gauge_ids.split(",") # Probably a list of strings # Do django models here: remove for id in gauge_ids: StreamGauge.delete(StreamGauge.objects.filter(stream_gauge_id=id)[0]) return "Success!" except Exception: return "Failure!"
def execute(self, gauge_ids, nhn_river_id, longitude, latitude, **kwargs): # All wps processes are required to convert the str representation # of their input parameters to the correct python type for execution try: gauge_ids = gauge_ids.split(",") # Probably a list of strings # Do django models here: Add for id in gauge_ids: if len(StreamGauge.objects.filter(stream_gauge_id=id)) != 0: StreamGauge.delete(StreamGauge.objects.filter(stream_gauge_id=id)[0]) sg_entry = StreamGauge(stream_gauge_id=id, river_segment_id=nhn_river_id, stream_gauge_x=longitude, stream_gauge_y=latitude) sg_entry.save() return "Success!" except Exception: return 'Failure!'