-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Upgrade to Django 2.2.9 #6494
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
Upgrade to Django 2.2.9 #6494
Conversation
The on_delete argument for ForeignKey and OneToOneField is now required in models and migrations. Consider squashing migrations so that you have fewer of them to update. https://docs.djangoproject.com/en/3.0/releases/2.0/#backwards-incompatible-changes-in-2-0
These permissions are created automatically by Django 2.x: https://docs.djangoproject.com/en/2.2/ref/models/options/#default-permissions The `view_` permission was added in 2.1. We were creating it manually when using 1.11.
To catch usage mistakes, the test Client and django.utils.http.urlencode() now raise TypeError if None is passed as a value to encode because None can’t be encoded in GET and POST data. Either pass an empty string or omit the value.
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.
Seems reasonable. Is there any specific testing we need to do on this locally to test it?
My main concern is about running the migrations (since they are modified) on a prod-like database. It should not be a problem because we are making the default value explicit only. However, that would be a good test. Another thing to verify is that creating an environment from scratch (without any migration ran yet) it does work. Locally, I did some QA and I didn't find anything strange/wrong. On the other hand, I'm blocking this PR since we need to make the merge of other dependencies (-ext and corporate) together with this one. Aside from that, we can test this PR without problems in .org. |
Was there a problem with just creating a new migration? |
This is not possible because when running the old migrations file it will fail because there is no |
I hadn't considered this. That's pretty unfortunate, but I think the way you did it is probably best. Note: this is what the 1.9 release notes suggest as well. |
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 not sure about the redirects failures in CI but otherwise this looks good. I put this through the paces of running a full build through docker including verifying the output. It looked good and ran well!
My main concern is about running the migrations (since they are modified) on a prod-like database.
No migrations are "run" as part of this since you are just modifying past migrations. I did run the migrations from both my current database and from scratch just to be sure. It ran fine.
We are setting this view as handler404 on tests, this view expects an extra arg (exception) https://docs.djangoproject.com/en/2.2/ref/views/#the-404-page-not-found-view (not sure why it worked before)
test_data.json contains references to eric.json
I have update this PR with
We are setting this view as handler404 on tests, https://docs.djangoproject.com/en/2.2/ref/views/#the-404-page-not-found-view (not sure why it worked before)
|
There are some migrations from django that we need to run
|
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 still want to test this a little more, but looks ok for now
readthedocs/proxito/views/serve.py
Outdated
@@ -151,7 +151,7 @@ class ServeDocs(SettingsOverrideObject): | |||
|
|||
class ServeError404Base(ServeRedirectMixin, ServeDocsMixin, View): | |||
|
|||
def get(self, request, proxito_path, template_name='404.html'): | |||
def get(self, request, proxito_path, *args, template_name='404.html', **kwargs): |
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 is not correct. The function definition is:
defaults.page_not_found(request, exception, template_name='404.html')
There is no *args
or **kwargs
on it.
What we need to change instead is
readthedocs.org/readthedocs/proxito/tests/handler_404_urls.py
Lines 24 to 31 in 3f6abb5
def inner_view(request, *args, **kwargs): | |
return view_func( | |
request, | |
*args, | |
proxito_path=request.get_full_path(), | |
**kwargs, | |
) | |
return inner_view |
I fixed this #6494 (comment) in a commit, but I push it when github was having problems, so it doesn't appear here... |
ce2e238
to
7b23d7a
Compare
Had to force push the last commit to make it appear : D |
Group of changes are divided into commits:
resolve
fromon_delete=models.CASCADE
to all those ForeignKey and OneToOneField in models and migrations filesview_
permissions manually created by us since they are automatically created since Django 2.1Closes #5058