Class based views #104

Closed
opened 2022-02-03 13:50:02 +01:00 by mpeltriaux · 2 comments
Owner

Status quo

The project is based on ye good ol fashioned method based views, which is fine and works properly.

However, we surely could reduce the size of our code base by switching to class based views.

Improvement

Refactor views from method based to class based, including all advantages class inheritance provides!

# Status quo The project is based on ye good ol fashioned method based views, which is fine and works properly. However, we surely could reduce the size of our code base by switching to class based views. # Improvement Refactor views from method based to class based, including all advantages class inheritance provides!
mpeltriaux added the
enhancement
backlog
labels 2022-02-03 13:50:02 +01:00
mpeltriaux self-assigned this 2022-02-03 13:50:02 +01:00
Author
Owner

Our BaseModalForm provides a method process_request() which handles GET as wekk as POST requests. This is handy in case of function based view structure, where the handling of GET and POST does not need to be placed inside the view logic.

However, to be able to support class based views on routes where BaseModalForm derivatives are used, the abstract class view will call the same logic on get() as on post() to ensure the same behaviour as previously on function based views.

This might look strange, but is an effective way to support the refactoring without touching existing logic on BaseModalForm.

Our `BaseModalForm` provides a method `process_request()` which handles `GET` as wekk as `POST` requests. This is handy in case of function based view structure, where the handling of `GET` and `POST` does not need to be placed inside the view logic. However, to be able to support class based views on routes where `BaseModalForm` derivatives are used, the abstract class view will call the same logic on `get()` as on `post()` to ensure the same behaviour as previously on function based views. This might look strange, but is an effective way to support the refactoring without touching existing logic on `BaseModalForm`.
Author
Owner

Merged in #200

# Merged in #200
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: IT-Naturschutz/konova#104
No description provided.