hearsaycorp / django-livefield

Convenient soft-deletion for Django models.
MIT License
35 stars 19 forks source link

Match signature of Model.delete() #19

Closed opbod closed 9 years ago

opbod commented 9 years ago

delete(self) will work, but at least PyCharm will throw a warning Signature of method MyClass.delete() does not match signature of base class method in class 'Model'. Changing to def delete(self, *args, **kwargs): fixes this.

adepue commented 9 years ago

@akshayjshah can you review?

akshayjshah commented 9 years ago

Thanks for the PR, @SaeX! I like the idea of matching the signature of Model.delete() - however, I'm not sure that the best solution is to accept (and ignore) arbitrary parameters.

It looks to me like Model.delete only has one keyword param: using. Could we instead do this?

def delete(self, using=None):
    self.live = False
    self.save(using=using)

It'd be nice to also change src/livefield/models.py to match.

opbod commented 9 years ago

That seems to do the job as well. No more warning with "using=None". Thanks!

akshayjshah commented 9 years ago

:shipit: Looks great!

hearsaydev commented 9 years ago

Attempting a merge on behalf of ashah. Stand clear!