Open agusmakmun opened 3 years ago
from reobject.models.manager import Manager class ReobjectManager(Manager): def get_or_create(self, defaults=None, **kwargs): self.model.objects.filter(**kwargs).delete() return super().get_or_create(defaults, **kwargs) class CourseModel(Model): course_slug = Field() title = Field() description = Field() objects = ReobjectManager()
But I'm seeing an error:
TypeError: __init__() missing 1 required positional argument: 'model'
when I fill it with objects = ReobjectManager(CourseModel) then it CourseModel not defined.
objects = ReobjectManager(CourseModel)
CourseModel
But I'm seeing an error:
when I fill it with
objects = ReobjectManager(CourseModel)
then itCourseModel
not defined.