File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
{{ cookiecutter.name }}/src/app Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,13 @@ def __str__(self) -> str:
2828 def get_contenttype (cls ) -> ContentType :
2929 return ContentType .objects .get_for_model (cls )
3030
31- def update_from_kwargs (self , ** kwargs : dict [str , Any ]) -> None :
32- """A shortcut method to update model instance from the kwargs."""
31+ def update (self , ** kwargs : "Any" ) -> "models.Model" :
3332 for key , value in kwargs .items ():
3433 setattr (self , key , value )
3534
36- def setattr_and_save (self , key : str , value : Any ) -> None :
37- """Shortcut for testing -- set attribute of the model and save"""
38- setattr (self , key , value )
39- self .save ()
35+ self .save (update_fields = kwargs .keys ())
36+
37+ return self
4038
4139 @classmethod
4240 def get_label (cls ) -> str :
You can’t perform that action at this time.
0 commit comments