Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

assert Model error #1

Closed
dejmail opened this issue Aug 31, 2022 · 2 comments
Closed

assert Model error #1

dejmail opened this issue Aug 31, 2022 · 2 comments

Comments

@dejmail
Copy link
Contributor

dejmail commented Aug 31, 2022

  File "/$HOME/venv/lib/python3.10/site-packages/vinyl/queryset.py", line 67, in __init__
    assert model
AssertionError

Hi there! Many thanks for putting in all the effort writing this library. I am trying to test it on the little Django project that I am busy with, but keep getting this AssertionError. Obvisouly the model is not making its way to the queryset init method. I have registered the custom manager as vinyl = VinylManager() under each model, and have registered the backend. I hope that I have done everything I need to, but as it is not working I'm sure something is missing or my understanding is lacking. Would you be able to shed any light? What is it that I am not understanding? Thanks!

@pwtail
Copy link
Owner

pwtail commented Sep 1, 2022

Hi @dejmail! I am sorry I forgot about this.

To test you currently have to call init_models signal after the models have been initialized. For example:

from django.apps import AppConfig
from vinyl import init_models

class MyAppConfig(AppConfig):

  def ready(self):
    init_models.send(AppConfig)

The final way to do the init is yet to be found

@dejmail
Copy link
Contributor Author

dejmail commented Sep 1, 2022

@pwtail Much appreciated. Created a pull request, as I think it is supposed to be from vinyl.manager import init_models.

@dejmail dejmail closed this as completed Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants