File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1- from datetime import datetime
1+ from datetime import datetime , timedelta
22from decimal import Decimal as D
33from enum import Enum
44from typing import Optional
@@ -42,6 +42,7 @@ class ObjectsView(UnicornView):
4242 book = Book (title = "The Sandman" )
4343 books = Book .objects .all ()
4444 date_example = now ()
45+ date_example_with_typehint : datetime = now ()
4546 float_example : float = 1.1
4647 decimal_example = D ("1.1" )
4748 int_example = 4
@@ -55,6 +56,11 @@ def check_date(self, dt: datetime):
5556
5657 self .date_example = dt
5758
59+ def add_hour (self ):
60+ self .date_example_with_typehint = self .date_example_with_typehint + timedelta (
61+ hours = 1
62+ )
63+
5864 def set_dictionary (self , val ):
5965 self .dictionary = val
6066
Original file line number Diff line number Diff line change 4444 < button u:click ='check_date("{{ date_example|date: 'c ' }}")'> check_date (c)</ button >
4545 < button u:click ='check_date({{ date_example|date: 'U ' }})'> check_date (U)</ button >
4646 </ div >
47+
48+ < div >
49+ {{ date_example_with_typehint }}
50+ </ div >
51+ < div >
52+ < button u:click ='add_hour() '> add_hour()</ button >
53+ </ div >
4754 </ div >
4855
4956 < div >
You can’t perform that action at this time.
0 commit comments