Home:ALL Converter>Django class method is currently overridden

Django class method is currently overridden

Ask Time:2018-06-03T19:41:37         Author:Quoc Huy

Json Formatter

This is the error when I tried to run python manage.py makemigrations in command line

ERRORS:
asking.Question: (models.E020) The 'Question.check()' class method is currently overridden by <function BaseManager.check at 0x7f0f104889d8>.

This is Question class in models.py:

class Question(BaseModel):
    content = models.CharField(max_length=250)
    answer = models.TextField("answer", blank=True, null=True)
    answerer = models.ForeignKey(
        User,
        on_delete=models.CASCADE,
        related_name="questions"
    )

    def __str__(self):
        return self.content

And this is BaseModel class:

from django.db import models
from model_utils.models import SoftDeletableManager, TimeStampedModel


class BaseModel(SoftDeletableManager, TimeStampedModel, models.Model):

    class Meta:
        abstract = True

I am using Django version 2.0.5

Author:Quoc Huy,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50665999/django-class-method-is-currently-overridden
eran :

I think the problem is that your BaseModel derives from SoftDeletableManager and not SoftDeletableModel.\n\ne.g change to:\n\nclass BaseModel(SoftDeletableModel, TimeStampedModel, models.Model):\n\n class Meta:\n abstract = True\n",
2018-06-03T12:58:17
yy