Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delete button in edit view #437

Closed
b1rger opened this issue Nov 27, 2023 · 7 comments · Fixed by #484 or #446
Closed

Fix delete button in edit view #437

b1rger opened this issue Nov 27, 2023 · 7 comments · Fixed by #484 or #446
Assignees
Labels
app-entities Anything to do with entities – the models central to an APIS app easy Should be an easy fix

Comments

@b1rger
Copy link
Contributor

b1rger commented Nov 27, 2023

The delete button in the edit view leads to 404, it should point to the delete view of the entity

@b1rger b1rger added app-entities Anything to do with entities – the models central to an APIS app easy Should be an easy fix labels Nov 27, 2023
@koeaw
Copy link
Contributor

koeaw commented Dec 5, 2023

I found an existing template confirm_delete.html for displaying to-be-deleted items in apis_core/core/templates – do I need to (re)use that one? Or can I recreate it just for entities in apis_core/apis_entities/templates/apis_entities/? If only for now?

The template needs cleaning up but this issue is already more time-consuming than I thought it would be, so I want to avoid adding more complexity by having to make sure I don't break anything for the other views that make use of it.

@b1rger
Copy link
Contributor Author

b1rger commented Dec 5, 2023

You don't have to touch the confirm_delete.html template. This issue is about this line in the edit_generic.html template:

<a class ="btn btn-danger btn-primary" href="delete">Delete</a>

which has delete hardcoded as href and therefore leads to a 404. It should point to the delete view of the entity that is edited, so either /apis/entities/entity/{entity_class}/{object.id}/delete or even better, to the generic_entities_delete_view url pattern name defined in:

@koeaw
Copy link
Contributor

koeaw commented Dec 5, 2023

Aha. So I looked at something different based on a misunderstanding on what the issue was about, but ran into a different problem in the process, which is what I've been working on.

I never looked at the edit template, only the edit view, and started from the only place I knew had a delete button, which is the detail view. Deleting is broken for me there, so it didn't occur to me to that this was about something else that's much simpler. o__O

Well, ok... I'll look into this smaller thing as well, but with the amount of time I've spent on this now, I'll mostly submit what I've come up with to fix the (larger) problem on my end. (Which may need further adaptation for other projects.)

@koeaw
Copy link
Contributor

koeaw commented Dec 5, 2023

Well I guess I'll open a separate issue & create a separate PR for my underlying problem with deleting.

@koeaw
Copy link
Contributor

koeaw commented Dec 6, 2023

Draft PR for the more general fix is here: #458

@b1rger
Copy link
Contributor Author

b1rger commented Dec 12, 2023

Draft PR for the more general fix is here: #458

Just FTR, #458 does not solve this issue

@koeaw
Copy link
Contributor

koeaw commented Dec 12, 2023

Well, the actual fix for this issue was indeed easy! 🙃😝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-entities Anything to do with entities – the models central to an APIS app easy Should be an easy fix
Projects
None yet
2 participants