I see that you are not removing the argument skipfrom kwargsbefore passing it to super().__init__. This means that "skip" is the name of the field, otherwise you get an exception TypeError("'skip' is an invalid keyword argument for this function").
do_something(), , , (??), .. .
, models.Model.__init__(...) *args **kwargs , . , "" , . , . :
... , __init__() . cls(*values)...
.
| @classmethod
| def from_db(cls, db, field_names, values):
| ...
| instance = cls(*values)
| ...
- do_something() super().__init__ self.skip kwargs, args.
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not self.skip:
do_something()
"post_init", super().__init__, .
*args (, - ):
def __init__(self, *args, **kwargs):
if kwargs:
skip = kwargs.get('skip', False)
else:
skip = any(field.name == 'skip' and val is True
for val, field in zip(args, self._meta.concrete_fields)
)
if not skip:
do_something()
super().__init__(*args, **kwargs)
EDIT: , , , -, - - . ( "" , , , . , .)