File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -26,21 +26,24 @@ __Update__:
26
26
and apply the updates to the appropriate table in the database
27
27
28
28
``` python
29
- @updateAfterEvent
30
- def method1 (self , args...):
31
- ...
32
- return self
33
-
34
- @updateAfterEvent
35
- def method2 (self , obj_2 , args ...):
36
- ...
37
- return obj_2
29
+ from utils import updateAfterEvent
30
+ ...
31
+ class foo :
32
+ @updateAfterEvent
33
+ def method1 (self , args...):
34
+ ...
35
+ return self
36
+
37
+ @updateAfterEvent
38
+ def method2 (self , obj_2 , args ...):
39
+ ...
40
+ return obj_2
38
41
```
39
- * You can put the decorator in a separate file then import it wherever you'll be using it (Ex: ` pokemonApp/mytools/ utils.py` )
42
+ * You can put the decorator in a separate file then import it wherever you'll be using it (Ex: ` utils.py ` )
40
43
41
44
> Manual update
42
45
43
- You can use the function ` updateObj ` (defined also in ` pokemonApp/mytools/ utils.py` ):
46
+ You can use the function ` updateObj ` (defined in ` utils.py ` ):
44
47
``` python
45
48
from utils import updateObj
46
49
obj_.attr += 10
You can’t perform that action at this time.
0 commit comments