-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no available initial state for the content type #34
Comments
This is happening because you probably didn't define your workflow scenarios yet. I mean, django-river tries to detect initial state in your workflow scenario according to one defined for your model content type and put this initial state into your model instances. This is done by django-river at two different times. Whenever you create a new instance from your model, and whenever you migrate your existing db(contains data) for django-river. You can check I should have prepared a tutorial to migrate from existing DB, I see this is the lack of If you need more help, let me know please. |
@javrasya oh i see.. since i am running it as a test i probably forgot to create the State, Transition and Proceeding objects to go along my test. When i test it manually everything works because i already have them in my database. I will try that and let you know if it works. Thanks |
@javrasya i still haven't figured it out. I tried recreating my admin workflow scenario in my test but still getting the
What am i doing wrong?? |
I will try to create a case as same as yours and reproduce it and let you know |
I spotted the problem. This is happenning why you don't give which field you want to create proceeding meta for. I designed django-river to work with multiple state field in a model and it used to work with it. But this was causing a lot of problem about injections and I decided to drop multiple field support. Single state field is supported each model now. But some part of this feature is remanining. I should remove them too I see it now. Create your proceeding meta by giving field too at the moment. I will remove exactly this field from django-river on next release; proceeding_meta = ProceedingMeta.objects.create(
content_type=content_type, transition=transition, field='status'
) |
@javrasya yes the workaround works, thanks. |
@javrasya This issue is somehow related to this one #32
So basically after creating my model with the
status = StateField(editable=False)
and migrating on an existing DB, i noticed that i had to do a makemigrations/migrate again for it to create an automatic proceeding migration0007_auto_20161014_1736
.Without this migrations, i would run into this error
river.utils.exceptions.RiverException: There is no available initial state for the content type mymodel
. With it everything worked fine.Now i am trying to run a unit test for my rest api endpoint were i have
instance = ModelClass.workflow.create(**validated_data)
to create a new object, but since i don't have that auto migration i am running intoriver.utils.exceptions.RiverException: There is no available initial state for the content type mymodel
. I triedcall_command('makemigrations', stdout=out)
andcall_command('migrate', stdout=out)
from within the test but not luck.Is there a better way to avoid this error all-together? Or a way for me to force that proceeding extra migration?
Thanks
The text was updated successfully, but these errors were encountered: