odmantic icon indicating copy to clipboard operation
odmantic copied to clipboard

Defining `__init__` in model throws `TypeError`

Open joeriddles opened this issue 3 years ago • 0 comments

Bug

Defining __init__ in a model that inherits from odmantic.Model raises TypeError.

Current Behavior

from odmantic import Model

class MyModel(Model):
  def __init__(self, **data):
    super().__init__(**data)

throws TypeError: __class__ set to <class '__main__.MyModel'> defining 'MyModel' as <class '__main__.MyModel'>

Expected behavior

Defining __init__ does not raise an error.

Environment

  • ODMantic version: 0.3.5
  • MongoDB version: N/A
  • Pydantic infos (output of python -c "import pydantic.utils; print(pydantic.utils.version_info())):
pydantic version: 1.8.2
            pydantic compiled: True
                 install path: ...\.venv\Lib\site-packages\pydantic
               python version: 3.9.3 (tags/v3.9.3:e723086, Apr  2 2021, 11:35:20) [MSC v.1928 64 bit (AMD64)]
                     platform: Windows-10-10.0.19041-SP0

joeriddles avatar Jun 28 '21 18:06 joeriddles