You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MVC as described by HTMX (here) allows us to focus on three separations of the app: Model, View, Controller. In django's terms, Model, View, Template.
If we followed this principal, this would mean that we could introduce a DRF JSON-Based API to allow any external application to connect to us, allowing for better integrations. This means we wouldn't have to duplicate logic.
You may think, well we'll still be duplicating the views, one rendering HTMX one rendering JSON... here's an explanation by HTMX.
So to achieve this we would need to move more logic to either the model layer (django models) or introduce a Service-based layer, which is like an in-between, which handles validation etc, returns a dictionary, and then the API and main app receive this and do whatever with it.
If anyone has experience with this architecture or django applications, feel free to reach out to me - i'd appreciate the extra help.
This seems like a suitable plan for the future of this application, otherwise we'll never be able to introduce a separate json based API without duplicating ALL logic.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
MVC as described by HTMX (here) allows us to focus on three separations of the app: Model, View, Controller. In django's terms, Model, View, Template.
If we followed this principal, this would mean that we could introduce a DRF JSON-Based API to allow any external application to connect to us, allowing for better integrations. This means we wouldn't have to duplicate logic.
You may think, well we'll still be duplicating the views, one rendering HTMX one rendering JSON... here's an explanation by HTMX.
So to achieve this we would need to move more logic to either the model layer (django models) or introduce a Service-based layer, which is like an in-between, which handles validation etc, returns a dictionary, and then the API and main app receive this and do whatever with it.
If anyone has experience with this architecture or django applications, feel free to reach out to me - i'd appreciate the extra help.
This seems like a suitable plan for the future of this application, otherwise we'll never be able to introduce a separate json based API without duplicating ALL logic.
Beta Was this translation helpful? Give feedback.
All reactions