def update_due_date(reminder): reminders = read_reminder_json() data = {} reminders.remove(reminder) new_due_date = datetime.strptime( reminder['due_date'], '%Y-%m-%d').date() + relativedelta(months=1) reminder['due_date'] = str(new_due_date) reminders.append(reminder) data['reminders'] = reminders write_reminder_json(data)
def delete_reminder(reminder): reminders = read_reminder_json() reminder_id = reminder['id'] reminder = [ reminder for reminder in reminders if reminder['id'] == reminder_id ] reminders.remove(reminder[0]) data = {} data['reminders'] = reminders write_reminder_json(data)
def delete_reminder(reminder_id): reminders = read_reminder_json() reminder = [ reminder for reminder in reminders if reminder['id'] == reminder_id ] if len(reminder) == 0: abort(404) reminders.remove(reminder[0]) data = {} data['reminders'] = reminders write_reminder_json(data) return jsonify({'message': 'Reminder has been removed successfully'})
def delete_reminder(reminder, update=False): if not update: reminders = read_reminder_json() reminder_id = reminder['id'] reminder = [ reminder for reminder in reminders if reminder['id'] == reminder_id ] reminders.remove(reminder[0]) data = {} data['reminders'] = reminders write_reminder_json(data) if update: while True: print('ERROR')