zsoldosp / django-currentuser

Conveniently store reference to request user on thread/db level.
BSD 3-Clause "New" or "Revised" License
159 stars 41 forks source link

Error on migrations - CurrentUserField argument ignored #69

Open melboone opened 1 year ago

melboone commented 1 year ago

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)

frague59 commented 1 year ago

+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