i want to delete and edit notes in my django app, but i am struck on this error for long Error : \"TypeError at /delete/1/ Field \'id\' expected a number but got .
You have to use note_id
instead of id
as below...
def del_note(request, note_id):
x = Note.objects.get(id = note_id)
# Your logic
def edit_note(request, note_id):
x = Note.objects.get(id = note_id)
# Your logic
If you want to edit then you can do it like...
def edit_note(request, note_id):
x = Note.objects.get(id = note_id)
x.field_name_1 = new_val_1
x.field_name_2 = new_val_2
# and so on for other fields...
x.save()
# Your logic