In your database there is a table called django_migrations.  Delete all
references in it to any other migration than the initial one.


[image: --]

Maninder Kumar
[image: http://]about.me/maninder.s.kumar
<http://about.me/maninder.s.kumar?promo=email_sig>




On Tue, Jan 21, 2020 at 1:37 AM Adrien Agnel <adrien.ag...@gmail.com> wrote:

> Hi everyone,
>
> This is my first post in this group so do not hesitate to ask for some
> more specific details if this is not enough. Django version is 2.2.9,
> Python 3.6.
>
>
> I'm facing an error when trying to migrate back the initial migration of a
> freshly installed new application 'billing'.
> The error message is the following one :
>
>> *ValueError: The field form.Form.ticket_description was declared with a
>> lazy reference to 'tickets.ticketdescription', but app 'tickets' doesn't
>> provide model 'ticketdescription'.*
>
>
> *However the model 'ticketdescription' has been dropped several month ago
> and is no longer present in my project*. Thus the part " app 'tickets'
> doesn't provide model 'ticketdescription' " is perfectly right, but I don't
> get why it is not managed by the migration of app 'tickets' which dropped
> the model 'ticketdescription'.
> The model 'ticketdescription' remains as a pending model of state apps in
> the migration executor, I would expect it to be removed.
>
> Until now, I could migrate backward other apps without any issue but after
> adding the app 'billing', which is not directly related to app 'tickets',
> it is not possible anymore.
>
>
>
> I don't know where to look at to fix this issue ? Could you help me
> debugging please ? This looks like a bug but I'm not sure !
>
> Best regards,
> Adrien
>
>
>
>
> Here is the full error trace :
>
> Traceback (most recent call last):
>>   File "manage.py", line 23, in <module>
>>     execute_from_command_line(sys.argv)
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/__init__.py",
>> line 381, in execute_from_command_line
>>     utility.execute()
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/__init__.py",
>> line 375, in execute
>>     self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/base.py", line
>> 323, in run_from_argv
>>     self.execute(*args, **cmd_options)
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/base.py", line
>> 364, in execute
>>     output = self.handle(*args, **options)
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/base.py", line
>> 83, in wrapped
>>     res = handle_func(*args, **kwargs)
>>   File
>> "[...]/lib/python3.6/site-packages/django/core/management/commands/migrate.py",
>> line 234, in handle
>>     fake_initial=fake_initial,
>>   File
>> "[...]/lib/python3.6/site-packages/django/db/migrations/executor.py", line
>> 121, in migrate
>>     state = self._migrate_all_backwards(plan, full_plan, fake=fake)
>>   File
>> "[...]/lib/python3.6/site-packages/django/db/migrations/executor.py", line
>> 173, in _migrate_all_backwards
>>     for migration, _ in full_plan:
>>   File "[...]/lib/python3.6/site-packages/django/utils/functional.py",
>> line 80, in __get__
>>     res = instance.__dict__[self.name] = self.func(instance)
>>   File "[...]/lib/python3.6/site-packages/django/db/migrations/state.py",
>> line 210, in apps
>>     return StateApps(self.real_apps, self.models)
>>   File "[...]/lib/python3.6/site-packages/django/db/migrations/state.py",
>> line 280, in __init__
>>     raise ValueError("\n".join(error.msg for error in errors))
>> ValueError: The field form.Form.ticket_description was declared with a
>> lazy reference to 'tickets.ticketdescription', but app 'tickets' doesn't
>> provide model 'ticketdescription'.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4f876052-71e5-4d25-9382-59d3c30d19f8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4f876052-71e5-4d25-9382-59d3c30d19f8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOHK3QtcD77ujM5-COCYkChntP8%3DvJgLs0C1kj_2aEKT0LDUQ%40mail.gmail.com.

Reply via email to