Skip to content

Commit

Permalink
ignoring save method override warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Dec 24, 2024
1 parent ee3a81e commit 17331c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ disable=print-statement,
too-many-arguments,
too-many-locals,
too-few-public-methods,
super-with-arguments
super-with-arguments,
arguments-differ

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
14 changes: 4 additions & 10 deletions fyle_accounting_mappings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,20 +1017,14 @@ class AutoAddCreateUpdateInfoMixin(models.Model):
class Meta:
abstract = True

def save(self, force_insert: bool = False, force_update: bool = False, using: str | None=None,
update_fields: Iterable[str] | None=None, **kwargs) -> None:
def save(self, *args, **kwargs):
"""
Override the save method to set created_by and updated_by fields.
Expects a 'user' keyword argument containing the user instance.
"""
user = kwargs.pop("user", None)
if user and hasattr(user, "email"):
user = kwargs.pop('user', None)
if user and hasattr(user, 'email'):
if not self.pk:
self.created_by = user.email
self.updated_by = user.email
super().save(
force_insert=force_insert,
force_update=force_update,
using=using,
update_fields=update_fields,
)
super().save(*args, **kwargs)

0 comments on commit 17331c6

Please sign in to comment.