From 17331c6388d4ea7aab4de30e1f85f904ac090f5a Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Tue, 24 Dec 2024 20:48:09 +0530 Subject: [PATCH] ignoring save method override warning --- .pylintrc | 3 ++- fyle_accounting_mappings/models.py | 14 ++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.pylintrc b/.pylintrc index d2a482d..83a7380 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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 diff --git a/fyle_accounting_mappings/models.py b/fyle_accounting_mappings/models.py index 23f215d..61137ce 100644 --- a/fyle_accounting_mappings/models.py +++ b/fyle_accounting_mappings/models.py @@ -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)