File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,21 @@ class TodoView(UnicornView):
1313 task = ""
1414 tasks = []
1515
16+ def __init__ (self , * args , ** kwargs ):
17+ super ().__init__ (** kwargs )
18+ self .hello = kwargs .get ("hello" , "not available" )
19+ print ("__init__() self.request" , self .request )
20+ print ("__init__() self.hello" , self .hello )
21+
22+ def hydrate (self ):
23+ print ("hydrate() self.hello" , self .hello )
24+
25+ def mount (self ):
26+ print ("mount() self.hello" , self .hello )
27+
1628 def add (self ):
29+ print ("add() self.hello" , self .hello )
30+
1731 if self .is_valid ():
1832 self .tasks .append (self .task )
1933 self .task = ""
Original file line number Diff line number Diff line change 66 < div class ="field has-addons ">
77 < p class ="control ">
88 < form unicorn:submit.prevent ="add ">
9- < input class ="input " type ="text " unicorn:model.lazy ="task " unicorn:keydown.escape ="task='' " placeholder ="New task " id ="task "> </ input >
9+ < input class ="input " type ="text " unicorn:model ="task " unicorn:keydown.escape ="task='' " placeholder ="New task " id ="task "> </ input >
1010 </ form >
1111 </ p >
1212 < p class ="control ">
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ <h2>Other inputs</h2>
77
88{% unicorn 'html-inputs' %}
99
10- {% unicorn 'todo' %}
10+ {% unicorn 'todo' hello='world' %}
11+
12+ {% unicorn 'todo' hello=example %}
1113
1214{% endblock content %}
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ def index(request):
99
1010def template (request , name ):
1111 try :
12- return render (request , f"www/{ name } .html" )
12+ return render (request , f"www/{ name } .html" , context = { "example" : "test" } )
1313 except TemplateDoesNotExist :
1414 raise Http404
You can’t perform that action at this time.
0 commit comments