django-currentuser icon indicating copy to clipboard operation
django-currentuser copied to clipboard

Error on migrations - CurrentUserField argument ignored

Open melboone opened this issue 2 years ago • 1 comments

Getting this error on migration:

UserWarning: You passed an argument to CurrentUserField that will be ignored. Avoid args and following kwargs: default, null, to. warnings.warn(self.warning)

melboone avatar Jun 15 '23 14:06 melboone

+1

My code looks like this, I use this model as mixin for many models in my apps.

class Administrable(models.Model):
    """An administrable model."""

    created_by = CurrentUserField(
        verbose_name=_("Created by"),
        related_name="%(app_label)s_%(class)s_creator",
    )

    updated_by = CurrentUserField(
        verbose_name=_("Updated by"),
        related_name="%(app_label)s_%(class)s_updater",
        on_update=True,
    )

    class Meta:
        """Metaclass for :class:`Administrable`."""

        abstract = True

frague59 avatar Jun 23 '23 07:06 frague59