Skip to content

Commit

Permalink
chore(controllers.md): update callback syntax in HomeController to us…
Browse files Browse the repository at this point in the history
…e dictionary format for better readability and maintainability

docs(usage.md): update form method override syntax to use `{{ method('PUT|DELETE|PATCH') }}` for better clarity and consistency
chore(__version__.py): bump up version to 2.9.0
chore(pyproject.toml): bump up version to 2.9.0
test(version_test.py): update test case to check for version 2.9.0 instead of 2.8.2
  • Loading branch information
marcuxyz committed Nov 28, 2023
1 parent ae8083f commit 6c133ee
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class HomeController:
return render_template("index.html")
```

If you have a question, please, check the app directory for more details.
## Callbacks

To use the hooks as `before_request`, `after_request`, etc... Just describe it in the controller, see:
You can use the callbacks as `before_request` and `after_request` to called the function before or after request... See:

```python
class HomeController:
before_request = ["hi"]
before_request = dict(callback="hi", actions="index")

def index(self):
return "home"
Expand Down
6 changes: 3 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class MessagesController:
<!-- app/views/messages/edit.html -->
{% block content %}
<form action="{{ url_for('messages.update', id=message.id) }}" method="POST">
<input type="hidden" name="_method" value="put">
<form action="{{ url_for('messages.update', id=message.id) }}" method="post">
{{ method('PUT') }}
<input type="text" name="title" id="title" value="Yeahh!">
<input type="submit" value="send">
</form>
{% endblock %}
```

The <input type="hidden" name="_method" value="put"> is necessary to work successfully!
You can use the `{{ method('PUT|DELETE|PATCH') }}` to creates supports for PUT and DELETE methods to forms.
2 changes: 1 addition & 1 deletion mvc_flask/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.8.2"
__version__ = "2.9.0"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mvc-flask"
version = "2.8.2"
version = "2.9.0"
description = "turn standard Flask into mvc"
authors = ["Marcus Pereira <[email protected]>"]

Expand Down
2 changes: 1 addition & 1 deletion tests/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_mvc_flask_currently_version():
__version__ == "2.8.2"
__version__ == "2.9.0"

0 comments on commit 6c133ee

Please sign in to comment.