-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add model update before a callMethod if it is a lazy model. Add `is_v…
…alid` to base component for a quicker check for validation errors. Handle validation errors slightly better when there are multiple models.
- Loading branch information
Showing
4 changed files
with
51 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
from django_unicorn.components import UnicornView | ||
from django import forms | ||
|
||
|
||
class TodoForm(forms.Form): | ||
task = forms.CharField(min_length=3, max_length=10, required=True) | ||
|
||
|
||
class TodoView(UnicornView): | ||
form_class = TodoForm | ||
|
||
task = "" | ||
tasks = [] | ||
|
||
def add(self): | ||
self.tasks.append(self.task) | ||
self.task = "" | ||
if self.is_valid(): | ||
self.tasks.append(self.task) | ||
self.task = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters