#28677: on_delete is a required positional argument for ForeignKeys, even in
migrations
-------------------------------------+-------------------------------------
Reporter: Christian | Owner: nobody
Kreuzberger |
Type: Bug | Status: new
Component: | Version: 2.0
Migrations | Keywords: migration
Severity: Normal | foreignkey on_delete
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi!
With version 2.0 you added `on_delete` as a required argument for
ForeignKeys. This seems to also be true for existing migrations of pre-2.0
projects.
For instance, I attached a migration that I created last year with (i
think) Django 1.8. This migration now fails with the following error
(e.g., when running `python manage.py check`):
{{{
File
"/home/user/projects/user_foreign_key_testapp/polls/migrations/0005_auto_20160414_1351.py",
line 7, in <module>
class Migration(migrations.Migration):
File
"/home/user/projects/user_foreign_key_testapp/polls/migrations/0005_auto_20160414_1351.py",
line 17, in Migration
field=models.ForeignKey(related_name='choices', verbose_name=b'Which
poll?', to='polls.Poll'),
TypeError: __init__() missing 1 required positional argument: 'on_delete'
}}}
I believe that I should not have to change all my existing migrations for
all my projects, and therefore on_delete should not be required for those
migrations.
--
Ticket URL: <https://code.djangoproject.com/ticket/28677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/059.f869c8f5630a897c6898a430280fa8bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.