Skip to content
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

Django 3 semi-stable #10007

Conversation

Johnetordoff
Copy link
Contributor

@Johnetordoff Johnetordoff commented Aug 4, 2022

Purpose

To document changes necessary to upgrade the OSF to Django 3.

  • updated requirements.txt √
  • squashed migrations √
  • updated django-include √
  • fixed misc bugs √

Changes

The Django-include branch being used is here: https://github.com/Johnetordoff/django-include/tree/django-3

QA Notes

Documentation

Side Effects

Ticket

Johnetordoff and others added 15 commits June 24, 2022 11:20
Use management command in post-migrate signal to create cache table instead of in Raw SQL in migrations
Co-authored-by: John Tordoff <>
* Create Waffle Flags and Switches as post_migrate_signal (with configurable values)
Co-authored-by: John Tordoff <>
…ience#9961)

* remove licenses from migration stream and only use post-migrate signal

Co-authored-by: John Tordoff <>
…ate signals (CenterForOpenScience#9974)

* Set noop to all ensure_schema migrations
* Set noop to shema and shema block updates
* Add ensuring schema and updating schema blocks to post-migrate signals
* Set noop to one-time data migrations, which include
  * Preprint permissions
  * Schema to schema blocks
  * Draft node permissions
* Remove manual post-migration signals from PND
* Move generate_object_id into migration utils
* Replace duplicate function with inline imports
…orOpenScience#9958)

* Fix signal and clean-up
* don't use bulk create until ignore_conflicts exsists
* allow BLACKLISTED_DOMAINS to be seamlessly overridden

Co-authored-by: John Tordoff <>
…nterForOpenScience#9966)

* Move loading of citation styles to post-migration signal
* Peg repo to commit SHA
* Attempt to speed things up by loading fixture
* Move update_citation_styles to management command
* Remove old test like thing
* Clean up URL setting and docstring
* Remove install bower from CI setup
* Reorder imports
* Reintroduce tests, but test skip them
* Final clean-up

Co-authored-by: John Tordoff <>
Co-authored-by: Longze Chen <[email protected]>
…OpenScience#9965)

* Remove storage region configuration from the migration stream and add to config file
* Only ensure default provider and remove yaml config
* Remove default storage region backfill
* Region gets or creates, but not updates
* Use _id and name as positional arguments and fix osf_settings

Co-authored-by: John Tordoff <>
Co-authored-by: Longze Chen <[email protected]>
…OpenScience/osf.io into upgrade-markdown

* 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io:
  [ENG-3836] Follow-up: Add PyYAML to Requirements (CenterForOpenScience#9993)
  [ENG-3867] Create Storage Regions on post migration signal (CenterForOpenScience#9965)
  [ENG-3866] Move citation style population out of migration stream (CenterForOpenScience#9966)
  [ENG-3868] Move blocked email domains to post-migrate signal (CenterForOpenScience#9958)
  [ENG-3863] Move schema ensuring and schema blocks update to post-migrate signals (CenterForOpenScience#9974)
  [ENG-3865] Create Licenses using post-migrate signal (CenterForOpenScience#9961)
  [ENG-3836] Investigate waffle flags (CenterForOpenScience#9950)
  move createcachetable to post migrate signal (CenterForOpenScience#9944)
  remove post-migrate signals from migration stream (CenterForOpenScience#9964)
  [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989)
  Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986)
  [ENG-3894] Outcome models (CenterForOpenScience#9975)
  revert color picker to working version (CenterForOpenScience#9968)
…OpenScience/osf.io into upgrade-password-reset

* 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io:
  [ENG-3836] Follow-up: Add PyYAML to Requirements (CenterForOpenScience#9993)
  [ENG-3867] Create Storage Regions on post migration signal (CenterForOpenScience#9965)
  [ENG-3866] Move citation style population out of migration stream (CenterForOpenScience#9966)
  [ENG-3868] Move blocked email domains to post-migrate signal (CenterForOpenScience#9958)
  [ENG-3863] Move schema ensuring and schema blocks update to post-migrate signals (CenterForOpenScience#9974)
  [ENG-3865] Create Licenses using post-migrate signal (CenterForOpenScience#9961)
  [ENG-3836] Investigate waffle flags (CenterForOpenScience#9950)
  move createcachetable to post migrate signal (CenterForOpenScience#9944)
  remove post-migrate signals from migration stream (CenterForOpenScience#9964)
  [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989)
  Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986)
  [ENG-3894] Outcome models (CenterForOpenScience#9975)
  revert color picker to working version (CenterForOpenScience#9968)
…OpenScience/osf.io into upgrade-markdown

* 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io:
  [ENG-3862] Move post-migrate signal out of migration stream for default providers (CenterForOpenScience#9971)
…OpenScience/osf.io into upgrade-password-reset

* 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io:
  [ENG-3862] Move post-migrate signal out of migration stream for default providers (CenterForOpenScience#9971)
@Johnetordoff Johnetordoff force-pushed the django-3 branch 2 times, most recently from 076803d to 07803f3 Compare August 4, 2022 18:23
@Johnetordoff Johnetordoff changed the title Django 3 Django 3 semi-stable Aug 4, 2022
import django.db.models.deletion


class Migration(migrations.Migration):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary due to our addon structure, regions are dependent on the Django osf app, but it's in the osfstorage addon app.

@@ -63,7 +63,7 @@ def backfill_egap_metadata(dry_run=False, batch_size=None):
schema_version=Max('registered_schema__schema_version')
).filter(
provider___id='egap',
additional_metadata=None, # JSON fields are weird
additional_metadata__isnull=True, # JSON fields are weird
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://docs.google.com/document/d/12En4sLtn5CrXZI89aNIqFjaYj26qebHC4SEYayZ_GrY/edit# Change to =None filter for django.contrib.postgres.fields.JSONField


def create_cache_table(sender, verbosity=0, **kwargs):
if getattr(sender, 'label', None) == 'osf':
call_command('createcachetable')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createcachetable doesn't take a tablename parameter anymore in Django 3

@Johnetordoff Johnetordoff force-pushed the django-3 branch 8 times, most recently from f5c68d3 to c43ea63 Compare August 8, 2022 19:17
@Johnetordoff Johnetordoff force-pushed the django-3 branch 5 times, most recently from 83fb1b1 to 549df5d Compare August 10, 2022 15:35
@Johnetordoff Johnetordoff force-pushed the django-3 branch 3 times, most recently from 0c7fb7e to feb809a Compare August 10, 2022 19:06
@Johnetordoff Johnetordoff force-pushed the django-3 branch 4 times, most recently from e14bb29 to b0a6446 Compare August 11, 2022 12:45
@Johnetordoff Johnetordoff force-pushed the django-3 branch 3 times, most recently from d4bc966 to cea3db6 Compare August 11, 2022 14:59
…OpenScience/osf.io into django-3

* 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io:
  Move file metadata population to unit test fixtures (CenterForOpenScience#9994)
  Update postgres backend and remove failover router for Django 3 (CenterForOpenScience#10011)
  Update import paths and fix deprecated modules for Django 3 (CenterForOpenScience#9983)
  Remove unused password change view/route (CenterForOpenScience#9985)

# Conflicts:
#	admin/common_auth/urls.py
#	api_tests/files/views/test_file_metadata_record_download.py
#	api_tests/schemas/views/test_file_metadata_schema_detail.py
#	osf/migrations/0136_add_datacite_file_metadata_schema.py
#	osf/migrations/0137_add_fm_record_to_osfstorage_files.py
#	osf/migrations/__init__.py
@cslzchen cslzchen force-pushed the feature/django_upgrade branch from c03627b to 9e9c487 Compare September 9, 2022 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants