Reusable Components : In Django, there are a lot of things out of the box but for things that it doesn't support, you are supposed to take multiple steps, that's what I encountered.
To make custom tags, you have to make
1, make ' templatetags' directory in your app
2, make
init.py 3, make your tags , for me it was nav_tags.py
Then in your template, load them and use them..
{% load nav_tags %}
...
- form attribute in Burton tags : If you have a button inside a form and the button is supposed to trigger another form since you can't have form inside a form, what are you supposed to do?
In the button add attribute called form
Delete
Then outside this form, creat the form of your need, in this case delete form and add id with the same name, you might also need to add hidden input with the same name in name attribute.
- Edit and delete in one logic: I found it's more convenient to not have separate logic to implement simple delete logic.
To make Django know what I wanted to do, I made hidden input in the delete form with the name attribute.
To know more about custome tags
Search : how to make Custom Tags
And read your own choice 🤗
If anything is unclear or if there is bad implementation, let me know