Issue: TypeError: super(type, obj): obj must be an instance or subtype of type
Author: jramosss
State: closed
Created: 2022-08-14 22:10:15

I'm trying to define a base model class for all my models, so i can get type hints when i execute model.get().
This is my code
```py
class BaseModel(models.Model):
    created_at: datetime = models.DateTimeField(default=datetime.now(tz=timezone.utc))

    def get(self, *query, **filters) -> Self:
        return super().get(*query, **filters)
    class Meta:
        database = db
```

but when i try to do 
`user = User.get(User.username == "test")`
i get the following error:
```
Traceback (most recent call last):
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 269, in __call__
    await super().__call__(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/exceptions.py", line 93, in __call__
    raise exc
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 227, in app
    raw_response = await run_endpoint_function(
  File "/home/shuls/Documents/weas/proyectos/truco2/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/shuls/Documents/weas/proyectos/truco2/./routers/sample_routers.py", line 12, in read_root
    user = User.get(User.username == "test")
  File "/home/shuls/Documents/weas/proyectos/truco2/./db/models.py", line 31, in get
    return super(BaseModel, self).get(*query, **filters)
TypeError: super(type, obj): obj must be an instance or subtype of type
```

OS: ubuntu 20.04 LTS
Python version: 3.10.6
pewee version: 3.15.1


`get()` is a classmethod. Check out the following:

```python
class BaseModel(Model):
    @classmethod
    def get(cls, *query, **filters):
        print('get() called on base.')
        return super(BaseModel, cls).get(*query, **filters)
    class Meta:
        database = db

class User(BaseModel):
    username = TextField()

db.create_tables([User])
User.create(username='u1')
print(User.get(User.username == 'u1').username)
print(User.get(username='u1').username)
```

Output:

```
get() called on base.
u1
get() called on base.
u1
```