Skip to content

RFC: Lint Django model .save() calls without update_fields argument #39

@eht16

Description

@eht16

This is not (yet) a feature request, just a request for comments.

What about a new rule to check for .save() calls of Django models with no explicit update_fields keyword argument specified?

I think in general, it is a good idea to explicitly use update_fields when saving Django models.

Though there are probably also cases where it is not possible at all (e.g. you simply do not know which fields were updated when using one or more subclasses or mixins or so). Or maybe there are cases where you explicitly want to save all fields of the model.

So, do you think such a rule might be too ambitious or might it work in general and it's feasible to declare corner cases with the noqa tag?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions