-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support Django 2.0 #40
Conversation
@@ -23,5 +23,5 @@ class TestParentModel(models.Model): | |||
|
|||
|
|||
class TestChildModel(models.Model): | |||
parent = models.ForeignKey(TestParentModel) | |||
parent = models.ForeignKey(TestParentModel, on_delete=models.CASCADE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on_delete
is always required.
https://docs.djangoproject.com/en/2.0/releases/1.9/#foreignkey-and-onetoonefield-on-delete-argument
django_redshift_backend/base.py
Outdated
@@ -159,8 +159,10 @@ def create_model(self, model): | |||
definition += " %s" % col_type_suffix | |||
params.extend(extra_params) | |||
# FK | |||
if field.rel and field.db_constraint: | |||
to_table = field.rel.to._meta.db_table | |||
if field.remote_field and field.db_constraint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field.rel
is deprecated in 1.9 and removed in 2.0.
https://docs.djangoproject.com/en/2.0/releases/1.9/#field-rel-changes
'Framework :: Django :: 1.11', | ||
'Framework :: Django :: 2.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I also overlooked ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct just one line.
django_redshift_backend/base.py
Outdated
if field.remote_field and field.db_constraint: | ||
to_table = field.remote_field.to._meta.db_table | ||
to_column = field.remote_field.to._meta.get_field( | ||
field.remote_field.field_name).column | ||
to_column = field.rel.to._meta.get_field(field.rel.field_name).column |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line must be removed because new code is provided at one line before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh... sorry
'Framework :: Django :: 1.11', | ||
'Framework :: Django :: 2.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I also overlooked ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Subject: Support Django 2.0
Feature or Bugfix
Relates