diff --git a/addons/osfstorage/models.py b/addons/osfstorage/models.py index aa9d8932317..3b386e8b76d 100644 --- a/addons/osfstorage/models.py +++ b/addons/osfstorage/models.py @@ -304,6 +304,9 @@ def create_version(self, creator, location, metadata=None): if metadata: version.update_metadata(metadata, save=False) + if 'osfstorage_region' in self.target.__dict__: # clear cache if cached + del self.target.osfstorage_region + version.region = self.target.osfstorage_region version._find_matching_archive(save=False) @@ -408,7 +411,7 @@ def save(self, skip_search=False, *args, **kwargs): class OsfStorageFolder(OsfStorageFileNode, Folder): - is_root = models.NullBooleanField() + is_root = models.BooleanField(null=True, blank=True) objects = OsfStorageFolderManager() diff --git a/addons/osfstorage/tests/test_models.py b/addons/osfstorage/tests/test_models.py index 85d975ce302..ca70f4fb182 100644 --- a/addons/osfstorage/tests/test_models.py +++ b/addons/osfstorage/tests/test_models.py @@ -198,10 +198,6 @@ def test_download_count_file(self, mock_session): def test_create_version(self): pass - @unittest.skip - def test_update_version_metadata(self): - pass - def test_delete_folder(self): parent = self.node_settings.get_root().append_folder('Test') kids = [] diff --git a/admin/asset_files/urls.py b/admin/asset_files/urls.py index 1ed3b37076d..55d3caf1991 100644 --- a/admin/asset_files/urls.py +++ b/admin/asset_files/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.ProviderAssetFileList.as_view(), name='list'), - url(r'^create/$', views.ProviderAssetFileCreate.as_view(), name='create'), - url(r'^(?P[0-9]+)/$', views.ProviderAssetFileDetail.as_view(), name='detail'), - url(r'^(?P[0-9]+)/delete/$', views.ProviderAssetFileDelete.as_view(), name='delete'), + re_path(r'^$', views.ProviderAssetFileList.as_view(), name='list'), + re_path(r'^create/$', views.ProviderAssetFileCreate.as_view(), name='create'), + re_path(r'^(?P[0-9]+)/$', views.ProviderAssetFileDetail.as_view(), name='detail'), + re_path(r'^(?P[0-9]+)/delete/$', views.ProviderAssetFileDelete.as_view(), name='delete'), ] diff --git a/admin/banners/urls.py b/admin/banners/urls.py index 9b755bf61c1..ac802960895 100644 --- a/admin/banners/urls.py +++ b/admin/banners/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.banners import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.BannerList.as_view(), name='list'), - url(r'^create/$', views.CreateBanner.as_view(), name='create'), - url(r'^(?P[0-9]+)/$', views.BannerDetail.as_view(), name='detail'), - url(r'^(?P[0-9]+)/delete/$', views.DeleteBanner.as_view(), name='delete'), + re_path(r'^$', views.BannerList.as_view(), name='list'), + re_path(r'^create/$', views.CreateBanner.as_view(), name='create'), + re_path(r'^(?P[0-9]+)/$', views.BannerDetail.as_view(), name='detail'), + re_path(r'^(?P[0-9]+)/delete/$', views.DeleteBanner.as_view(), name='delete'), ] diff --git a/admin/base/urls.py b/admin/base/urls.py index a43968e9079..9a20b3d2ef9 100644 --- a/admin/base/urls.py +++ b/admin/base/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import include, url +from django.conf.urls import include, re_path from django.contrib import admin from admin.base.settings import ADMIN_BASE, DEBUG from admin.base import views @@ -7,32 +7,32 @@ urlpatterns = [ ### ADMIN ### - url( + re_path( base_pattern, include([ - url(r'^$', views.home, name='home'), - url(r'^admin/', admin.site.urls), - url(r'^asset_files/', include('admin.asset_files.urls', namespace='asset_files')), - url(r'^banners/', include('admin.banners.urls', namespace='banners')), - url(r'^brands/', include('admin.brands.urls', namespace='brands')), - url(r'^comments/', include('admin.comments.urls', namespace='comments')), - url(r'^institutions/', include('admin.institutions.urls', namespace='institutions')), - url(r'^preprint_providers/', include('admin.preprint_providers.urls', namespace='preprint_providers')), - url(r'^collection_providers/', include('admin.collection_providers.urls', namespace='collection_providers')), - url(r'^registration_providers/', include('admin.registration_providers.urls', namespace='registration_providers')), - url(r'^account/', include('admin.common_auth.urls', namespace='auth')), - url(r'^nodes/', include('admin.nodes.urls', namespace='nodes')), - url(r'^preprints/', include('admin.preprints.urls', namespace='preprints')), - url(r'^subjects/', include('admin.subjects.urls', namespace='subjects')), - url(r'^users/', include('admin.users.urls', namespace='users')), - url(r'^maintenance/', include('admin.maintenance.urls', namespace='maintenance')), - url(r'^meetings/', include('admin.meetings.urls', namespace='meetings')), - url(r'^metrics/', include('admin.metrics.urls', namespace='metrics')), - url(r'^osf_groups/', include('admin.osf_groups.urls', namespace='osf_groups')), - url(r'^management/', include('admin.management.urls', namespace='management')), - url(r'^internet_archive/', include('admin.internet_archive.urls', namespace='internet_archive')), - url(r'^schema_responses/', include('admin.schema_responses.urls', namespace='schema_responses')), - url(r'^registration_schemas/', include('admin.registration_schemas.urls', namespace='registration_schemas')), + re_path(r'^$', views.home, name='home'), + re_path(r'^admin/', admin.site.urls), + re_path(r'^asset_files/', include('admin.asset_files.urls', namespace='asset_files')), + re_path(r'^banners/', include('admin.banners.urls', namespace='banners')), + re_path(r'^brands/', include('admin.brands.urls', namespace='brands')), + re_path(r'^comments/', include('admin.comments.urls', namespace='comments')), + re_path(r'^institutions/', include('admin.institutions.urls', namespace='institutions')), + re_path(r'^preprint_providers/', include('admin.preprint_providers.urls', namespace='preprint_providers')), + re_path(r'^collection_providers/', include('admin.collection_providers.urls', namespace='collection_providers')), + re_path(r'^registration_providers/', include('admin.registration_providers.urls', namespace='registration_providers')), + re_path(r'^account/', include('admin.common_auth.urls', namespace='auth')), + re_path(r'^nodes/', include('admin.nodes.urls', namespace='nodes')), + re_path(r'^preprints/', include('admin.preprints.urls', namespace='preprints')), + re_path(r'^subjects/', include('admin.subjects.urls', namespace='subjects')), + re_path(r'^users/', include('admin.users.urls', namespace='users')), + re_path(r'^maintenance/', include('admin.maintenance.urls', namespace='maintenance')), + re_path(r'^meetings/', include('admin.meetings.urls', namespace='meetings')), + re_path(r'^metrics/', include('admin.metrics.urls', namespace='metrics')), + re_path(r'^osf_groups/', include('admin.osf_groups.urls', namespace='osf_groups')), + re_path(r'^management/', include('admin.management.urls', namespace='management')), + re_path(r'^internet_archive/', include('admin.internet_archive.urls', namespace='internet_archive')), + re_path(r'^schema_responses/', include('admin.schema_responses.urls', namespace='schema_responses')), + re_path(r'^registration_schemas/', include('admin.registration_schemas.urls', namespace='registration_schemas')), ]), ), ] @@ -41,7 +41,7 @@ import debug_toolbar urlpatterns += [ - url(r'^__debug__/', include(debug_toolbar.urls)), + re_path(r'^__debug__/', include(debug_toolbar.urls)), ] admin.site.site_header = 'OSF-Admin administration' diff --git a/admin/brands/urls.py b/admin/brands/urls.py index aed3bf768d6..4c82092cf36 100644 --- a/admin/brands/urls.py +++ b/admin/brands/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.BrandList.as_view(), name='list'), - url(r'^create/$', views.BrandCreate.as_view(), name='create'), - url(r'^(?P[0-9]+)/$', views.BrandDetail.as_view(), name='detail'), + re_path(r'^$', views.BrandList.as_view(), name='list'), + re_path(r'^create/$', views.BrandCreate.as_view(), name='create'), + re_path(r'^(?P[0-9]+)/$', views.BrandDetail.as_view(), name='detail'), ] diff --git a/admin/collection_providers/urls.py b/admin/collection_providers/urls.py index 8fdaf68d9aa..ebaec081811 100644 --- a/admin/collection_providers/urls.py +++ b/admin/collection_providers/urls.py @@ -1,15 +1,15 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^create/$', views.CreateCollectionProvider.as_view(), name='create'), - url(r'^$', views.CollectionProviderList.as_view(), name='list'), - url(r'^import/$', views.ImportCollectionProvider.as_view(), name='import'), - url(r'^(?P[a-z0-9]+)/$', views.CollectionProviderDetail.as_view(), name='detail'), - url(r'^(?P[a-z0-9]+)/delete/$', views.DeleteCollectionProvider.as_view(), name='delete'), - url(r'^(?P[a-z0-9]+)/export/$', views.ExportColectionProvider.as_view(), name='export'), - url(r'^(?P[a-z0-9]+)/import/$', views.ImportCollectionProvider.as_view(), name='import'), - url(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), + re_path(r'^create/$', views.CreateCollectionProvider.as_view(), name='create'), + re_path(r'^$', views.CollectionProviderList.as_view(), name='list'), + re_path(r'^import/$', views.ImportCollectionProvider.as_view(), name='import'), + re_path(r'^(?P[a-z0-9]+)/$', views.CollectionProviderDetail.as_view(), name='detail'), + re_path(r'^(?P[a-z0-9]+)/delete/$', views.DeleteCollectionProvider.as_view(), name='delete'), + re_path(r'^(?P[a-z0-9]+)/export/$', views.ExportColectionProvider.as_view(), name='export'), + re_path(r'^(?P[a-z0-9]+)/import/$', views.ImportCollectionProvider.as_view(), name='import'), + re_path(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), ] diff --git a/admin/comments/urls.py b/admin/comments/urls.py index 24b377f2c9c..e9992572208 100644 --- a/admin/comments/urls.py +++ b/admin/comments/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.CommentList.as_view(), name='comments'), - url(r'^(?P[a-z0-9]+)/$', views.CommentDetail.as_view(), name='comment-detail'), - url(r'^(?P[a-z0-9]+)/mark_spam/$', views.CommentSpamView.as_view(), name='mark-spam'), - url(r'^user/(?P[a-z0-9]+)/$', views.UserCommentList.as_view(), name='user-comment'), + re_path(r'^$', views.CommentList.as_view(), name='comments'), + re_path(r'^(?P[a-z0-9]+)/$', views.CommentDetail.as_view(), name='comment-detail'), + re_path(r'^(?P[a-z0-9]+)/mark_spam/$', views.CommentSpamView.as_view(), name='mark-spam'), + re_path(r'^user/(?P[a-z0-9]+)/$', views.UserCommentList.as_view(), name='user-comment'), ] diff --git a/admin/common_auth/urls.py b/admin/common_auth/urls.py index 07e676a892e..cf697eb8888 100644 --- a/admin/common_auth/urls.py +++ b/admin/common_auth/urls.py @@ -1,15 +1,15 @@ from __future__ import absolute_import -from django.conf.urls import url +from django.conf.urls import re_path from admin.common_auth import views app_name = 'admin' urlpatterns = [ - url(r'^login/?$', views.LoginView.as_view(), name='login'), - url(r'^logout/$', views.logout_user, name='logout'), - url(r'^register/$', views.RegisterUser.as_view(), name='register'), - url(r'^settings/desk/$', views.DeskUserCreateFormView.as_view(), name='desk'), - url(r'^settings/desk/update/$', views.DeskUserUpdateFormView.as_view(), name='desk_update'), + re_path(r'^login/?$', views.LoginView.as_view(), name='login'), + re_path(r'^logout/$', views.logout_user, name='logout'), + re_path(r'^register/$', views.RegisterUser.as_view(), name='register'), + re_path(r'^settings/desk/$', views.DeskUserCreateFormView.as_view(), name='desk'), + re_path(r'^settings/desk/update/$', views.DeskUserUpdateFormView.as_view(), name='desk_update'), ] diff --git a/admin/institutions/urls.py b/admin/institutions/urls.py index 8e34d8a8acf..c671a09a6e0 100644 --- a/admin/institutions/urls.py +++ b/admin/institutions/urls.py @@ -1,18 +1,18 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.InstitutionList.as_view(), name='list'), - url(r'^create/$', views.CreateInstitution.as_view(), name='create'), - url(r'^import/$', views.ImportInstitution.as_view(), name='import'), - url(r'^(?P[0-9]+)/$', views.InstitutionDetail.as_view(), name='detail'), - url(r'^(?P[0-9]+)/export/$', views.InstitutionExport.as_view(), name='export'), - url(r'^(?P[0-9]+)/delete/$', views.DeleteInstitution.as_view(), name='delete'), - url(r'^(?P[0-9]+)/deactivate/$', views.DeactivateInstitution.as_view(), name='deactivate'), - url(r'^(?P[0-9]+)/reactivate/$', views.ReactivateInstitution.as_view(), name='reactivate'), - url(r'^(?P[0-9]+)/cannot_delete/$', views.CannotDeleteInstitution.as_view(), name='cannot_delete'), - url(r'^(?P[0-9]+)/nodes/$', views.InstitutionNodeList.as_view(), name='nodes'), - url(r'^(?P[0-9]+)/register/$', views.InstitutionalMetricsAdminRegister.as_view(), name='register_metrics_admin'), + re_path(r'^$', views.InstitutionList.as_view(), name='list'), + re_path(r'^create/$', views.CreateInstitution.as_view(), name='create'), + re_path(r'^import/$', views.ImportInstitution.as_view(), name='import'), + re_path(r'^(?P[0-9]+)/$', views.InstitutionDetail.as_view(), name='detail'), + re_path(r'^(?P[0-9]+)/export/$', views.InstitutionExport.as_view(), name='export'), + re_path(r'^(?P[0-9]+)/delete/$', views.DeleteInstitution.as_view(), name='delete'), + re_path(r'^(?P[0-9]+)/deactivate/$', views.DeactivateInstitution.as_view(), name='deactivate'), + re_path(r'^(?P[0-9]+)/reactivate/$', views.ReactivateInstitution.as_view(), name='reactivate'), + re_path(r'^(?P[0-9]+)/cannot_delete/$', views.CannotDeleteInstitution.as_view(), name='cannot_delete'), + re_path(r'^(?P[0-9]+)/nodes/$', views.InstitutionNodeList.as_view(), name='nodes'), + re_path(r'^(?P[0-9]+)/register/$', views.InstitutionalMetricsAdminRegister.as_view(), name='register_metrics_admin'), ] diff --git a/admin/internet_archive/urls.py b/admin/internet_archive/urls.py index 3494690be86..2c045c128f5 100644 --- a/admin/internet_archive/urls.py +++ b/admin/internet_archive/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.internet_archive import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.InternetArchiveView.as_view(), name='internet_archive'), - url(r'^pigeon', views.SendToPigeon.as_view(), name='pigeon'), - url(r'^create_ia_subcollections', views.CreateIASubcollections.as_view(), name='create_ia_subcollections'), - url(r'^check_ia_metadata', views.CheckIAMetadata.as_view(), name='check_ia_metadata'), - url(r'^sync_ia_metadata', views.SyncIAMetadata.as_view(), name='sync_ia_metadata'), + re_path(r'^$', views.InternetArchiveView.as_view(), name='internet_archive'), + re_path(r'^pigeon', views.SendToPigeon.as_view(), name='pigeon'), + re_path(r'^create_ia_subcollections', views.CreateIASubcollections.as_view(), name='create_ia_subcollections'), + re_path(r'^check_ia_metadata', views.CheckIAMetadata.as_view(), name='check_ia_metadata'), + re_path(r'^sync_ia_metadata', views.SyncIAMetadata.as_view(), name='sync_ia_metadata'), ] diff --git a/admin/maintenance/urls.py b/admin/maintenance/urls.py index 009c5426aea..7e86a30cbe6 100644 --- a/admin/maintenance/urls.py +++ b/admin/maintenance/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.MaintenanceDisplay.as_view(), name='display'), - url(r'^remove/$', views.DeleteMaintenance.as_view(), name='delete'), + re_path(r'^$', views.MaintenanceDisplay.as_view(), name='display'), + re_path(r'^remove/$', views.DeleteMaintenance.as_view(), name='delete'), ] diff --git a/admin/management/urls.py b/admin/management/urls.py index 5510c52c4ac..28188bb03fe 100644 --- a/admin/management/urls.py +++ b/admin/management/urls.py @@ -1,18 +1,18 @@ from __future__ import absolute_import -from django.conf.urls import url +from django.conf.urls import re_path from admin.management import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.ManagementCommands.as_view(), name='commands'), - url(r'^waffle_flag', views.WaffleFlag.as_view(), name='waffle_flag'), - url(r'^update_registration_schemas', + re_path(r'^$', views.ManagementCommands.as_view(), name='commands'), + re_path(r'^waffle_flag', views.WaffleFlag.as_view(), name='waffle_flag'), + re_path(r'^update_registration_schemas', views.UpdateRegistrationSchemas.as_view(), name='update_registration_schemas'), - url(r'^get_spam_csv', views.GetSpamDataCSV.as_view(), name='get_spam_csv'), - url(r'^ban_spam_regex', views.BanSpamByRegex.as_view(), name='ban_spam_regex'), - url(r'^daily_reporters_go', views.DailyReportersGo.as_view(), name='daily_reporters_go'), + re_path(r'^get_spam_csv', views.GetSpamDataCSV.as_view(), name='get_spam_csv'), + re_path(r'^ban_spam_regex', views.BanSpamByRegex.as_view(), name='ban_spam_regex'), + re_path(r'^daily_reporters_go', views.DailyReportersGo.as_view(), name='daily_reporters_go'), ] diff --git a/admin/meetings/urls.py b/admin/meetings/urls.py index 6d7a440d0cd..1b674a19316 100644 --- a/admin/meetings/urls.py +++ b/admin/meetings/urls.py @@ -1,14 +1,14 @@ from __future__ import absolute_import -from django.conf.urls import url +from django.conf.urls import re_path from admin.meetings import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.MeetingListView.as_view(), name='list'), - url(r'^create/$', views.MeetingCreateFormView.as_view(), name='create'), - url(r'^(?P[a-zA-Z0-9_]+)/$', views.MeetingFormView.as_view(), + re_path(r'^$', views.MeetingListView.as_view(), name='list'), + re_path(r'^create/$', views.MeetingCreateFormView.as_view(), name='create'), + re_path(r'^(?P[a-zA-Z0-9_]+)/$', views.MeetingFormView.as_view(), name='detail'), ] diff --git a/admin/metrics/urls.py b/admin/metrics/urls.py index b8618dacf39..8c3eb7c1a48 100644 --- a/admin/metrics/urls.py +++ b/admin/metrics/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import re_path from django.contrib.auth.decorators import login_required as login from . import views @@ -6,5 +6,5 @@ app_name = 'admin' urlpatterns = [ - url(r'^$', login(views.MetricsView.as_view()), name='metrics'), + re_path(r'^$', login(views.MetricsView.as_view()), name='metrics'), ] diff --git a/admin/nodes/urls.py b/admin/nodes/urls.py index 149fb6f5c72..780ffd9d28f 100644 --- a/admin/nodes/urls.py +++ b/admin/nodes/urls.py @@ -1,40 +1,40 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.nodes import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.NodeSearchView.as_view(), name='search'), - url(r'^flagged_spam$', views.NodeFlaggedSpamList.as_view(), name='flagged-spam'), - url(r'^known_spam$', views.NodeKnownSpamList.as_view(), name='known-spam'), - url(r'^known_ham$', views.NodeKnownHamList.as_view(), name='known-ham'), - url(r'^doi_backlog_list/$', views.DoiBacklogListView.as_view(), name='doi-backlog-list'), - url(r'^registration_list/$', views.RegistrationListView.as_view(), name='registrations'), - url(r'^stuck_registration_list/$', views.StuckRegistrationListView.as_view(), name='stuck-registrations'), - url(r'^ia_backlog_list/$', views.RegistrationBacklogListView.as_view(), name='ia-backlog-list'), - url(r'^(?P[a-z0-9]+)/$', views.NodeView.as_view(), name='node'), - url(r'^(?P[a-z0-9]+)/logs/$', views.AdminNodeLogView.as_view(), name='node-logs'), - url(r'^(?P[a-z0-9]+)/schema_responses/$', views.AdminNodeSchemaResponseView.as_view(), + re_path(r'^$', views.NodeSearchView.as_view(), name='search'), + re_path(r'^flagged_spam$', views.NodeFlaggedSpamList.as_view(), name='flagged-spam'), + re_path(r'^known_spam$', views.NodeKnownSpamList.as_view(), name='known-spam'), + re_path(r'^known_ham$', views.NodeKnownHamList.as_view(), name='known-ham'), + re_path(r'^doi_backlog_list/$', views.DoiBacklogListView.as_view(), name='doi-backlog-list'), + re_path(r'^registration_list/$', views.RegistrationListView.as_view(), name='registrations'), + re_path(r'^stuck_registration_list/$', views.StuckRegistrationListView.as_view(), name='stuck-registrations'), + re_path(r'^ia_backlog_list/$', views.RegistrationBacklogListView.as_view(), name='ia-backlog-list'), + re_path(r'^(?P[a-z0-9]+)/$', views.NodeView.as_view(), name='node'), + re_path(r'^(?P[a-z0-9]+)/logs/$', views.AdminNodeLogView.as_view(), name='node-logs'), + re_path(r'^(?P[a-z0-9]+)/schema_responses/$', views.AdminNodeSchemaResponseView.as_view(), name='schema-responses'), - url(r'^(?P[a-z0-9]+)/update_embargo/$', views.RegistrationUpdateEmbargoView.as_view(), name='update-embargo'), - url(r'^(?P[a-z0-9]+)/remove/$', views.NodeDeleteView.as_view(), name='remove'), - url(r'^(?P[a-z0-9]+)/restore/$', views.NodeDeleteView.as_view(), name='restore'), - url(r'^(?P[a-z0-9]+)/confirm_spam/$', views.NodeConfirmSpamView.as_view(), name='confirm-spam'), - url(r'^(?P[a-z0-9]+)/confirm_ham/$', views.NodeConfirmHamView.as_view(), name='confirm-ham'), - url(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.NodeConfirmUnflagView.as_view(), name='confirm-unflag'), - url(r'^(?P[a-z0-9]+)/reindex_share_node/$', views.NodeReindexShare.as_view(), name='reindex-share-node'), - url(r'^(?P[a-z0-9]+)/reindex_elastic_node/$', views.NodeReindexElastic.as_view(), + re_path(r'^(?P[a-z0-9]+)/update_embargo/$', views.RegistrationUpdateEmbargoView.as_view(), name='update-embargo'), + re_path(r'^(?P[a-z0-9]+)/remove/$', views.NodeDeleteView.as_view(), name='remove'), + re_path(r'^(?P[a-z0-9]+)/restore/$', views.NodeDeleteView.as_view(), name='restore'), + re_path(r'^(?P[a-z0-9]+)/confirm_spam/$', views.NodeConfirmSpamView.as_view(), name='confirm-spam'), + re_path(r'^(?P[a-z0-9]+)/confirm_ham/$', views.NodeConfirmHamView.as_view(), name='confirm-ham'), + re_path(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.NodeConfirmUnflagView.as_view(), name='confirm-unflag'), + re_path(r'^(?P[a-z0-9]+)/reindex_share_node/$', views.NodeReindexShare.as_view(), name='reindex-share-node'), + re_path(r'^(?P[a-z0-9]+)/reindex_elastic_node/$', views.NodeReindexElastic.as_view(), name='reindex-elastic-node'), - url(r'^(?P[a-z0-9]+)/restart_stuck_registrations/$', views.RestartStuckRegistrationsView.as_view(), + re_path(r'^(?P[a-z0-9]+)/restart_stuck_registrations/$', views.RestartStuckRegistrationsView.as_view(), name='restart-stuck-registrations'), - url(r'^(?P[a-z0-9]+)/remove_stuck_registrations/$', views.RemoveStuckRegistrationsView.as_view(), + re_path(r'^(?P[a-z0-9]+)/remove_stuck_registrations/$', views.RemoveStuckRegistrationsView.as_view(), name='remove-stuck-registrations'), - url(r'^(?P[a-z0-9]+)/remove_user/(?P[a-z0-9]+)/$', views.NodeRemoveContributorView.as_view(), + re_path(r'^(?P[a-z0-9]+)/remove_user/(?P[a-z0-9]+)/$', views.NodeRemoveContributorView.as_view(), name='remove-user'), - url(r'^(?P[a-z0-9]+)/modify_storage_usage/$', views.NodeModifyStorageUsage.as_view(), + re_path(r'^(?P[a-z0-9]+)/modify_storage_usage/$', views.NodeModifyStorageUsage.as_view(), name='adjust-storage-usage'), - url(r'^(?P[a-z0-9]+)/recalculate_node_storage/$', views.NodeRecalculateStorage.as_view(), + re_path(r'^(?P[a-z0-9]+)/recalculate_node_storage/$', views.NodeRecalculateStorage.as_view(), name='recalculate-node-storage'), - url(r'^(?P[a-z0-9]+)/make_private/$', views.NodeMakePrivate.as_view(), name='make-private'), - url(r'^(?P[a-z0-9]+)/make_public/$', views.NodeMakePublic.as_view(), name='make-public'), + re_path(r'^(?P[a-z0-9]+)/make_private/$', views.NodeMakePrivate.as_view(), name='make-private'), + re_path(r'^(?P[a-z0-9]+)/make_public/$', views.NodeMakePublic.as_view(), name='make-public'), ] diff --git a/admin/osf_groups/urls.py b/admin/osf_groups/urls.py index 7a07ffcea53..4cfb38d9d20 100644 --- a/admin/osf_groups/urls.py +++ b/admin/osf_groups/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.osf_groups import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.OSFGroupsListView.as_view(), name='osf_groups_list'), - url(r'^search/$', views.OSFGroupsFormView.as_view(), name='search'), - url(r'^(?P[a-z0-9]+)/$', views.OSFGroupsView.as_view(), name='osf_group'), + re_path(r'^$', views.OSFGroupsListView.as_view(), name='osf_groups_list'), + re_path(r'^search/$', views.OSFGroupsFormView.as_view(), name='search'), + re_path(r'^(?P[a-z0-9]+)/$', views.OSFGroupsView.as_view(), name='osf_group'), ] diff --git a/admin/preprint_providers/urls.py b/admin/preprint_providers/urls.py index 0c792835cc8..645085bf483 100644 --- a/admin/preprint_providers/urls.py +++ b/admin/preprint_providers/urls.py @@ -1,23 +1,23 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.PreprintProviderList.as_view(), name='list'), - url(r'^create/$', views.CreatePreprintProvider.as_view(), name='create'), - url(r'^import/$', views.ImportPreprintProvider.as_view(), name='import'), - url(r'^(?P[a-z0-9]+)/import/$', views.ImportPreprintProvider.as_view(), name='import'), - url(r'^get_subjects/$', views.SubjectDynamicUpdateView.as_view(), name='get_subjects'), - url(r'^get_descendants/$', views.GetSubjectDescendants.as_view(), name='get_descendants'), - url(r'^rules_to_subjects/$', views.RulesToSubjects.as_view(), name='rules_to_subjects'), - url(r'^whitelist/$', views.SharePreprintProviderWhitelist.as_view(), name='whitelist'), - url(r'^(?P[a-z0-9]+)/process_custom_taxonomy/$', views.ProcessCustomTaxonomy.as_view(), name='process_custom_taxonomy'), - url(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), - url(r'^(?P[a-z0-9]+)/$', views.PreprintProviderDetail.as_view(), name='detail'), - url(r'^(?P[a-z0-9]+)/delete/$', views.DeletePreprintProvider.as_view(), name='delete'), - url(r'^(?P[a-z0-9]+)/export/$', views.ExportPreprintProvider.as_view(), name='export'), - url(r'^(?P[a-z0-9]+)/share_source/$', views.ShareSourcePreprintProvider.as_view(), name='share_source'), - url(r'^(?P[a-z0-9]+)/register/$', views.PreprintProviderRegisterModeratorOrAdmin.as_view(), name='register_moderator_admin'), - url(r'^(?P[a-z0-9]+)/edit/$', views.PreprintProviderChangeForm.as_view(), name='edit'), + re_path(r'^$', views.PreprintProviderList.as_view(), name='list'), + re_path(r'^create/$', views.CreatePreprintProvider.as_view(), name='create'), + re_path(r'^import/$', views.ImportPreprintProvider.as_view(), name='import'), + re_path(r'^(?P[a-z0-9]+)/import/$', views.ImportPreprintProvider.as_view(), name='import'), + re_path(r'^get_subjects/$', views.SubjectDynamicUpdateView.as_view(), name='get_subjects'), + re_path(r'^get_descendants/$', views.GetSubjectDescendants.as_view(), name='get_descendants'), + re_path(r'^rules_to_subjects/$', views.RulesToSubjects.as_view(), name='rules_to_subjects'), + re_path(r'^whitelist/$', views.SharePreprintProviderWhitelist.as_view(), name='whitelist'), + re_path(r'^(?P[a-z0-9]+)/process_custom_taxonomy/$', views.ProcessCustomTaxonomy.as_view(), name='process_custom_taxonomy'), + re_path(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), + re_path(r'^(?P[a-z0-9]+)/$', views.PreprintProviderDetail.as_view(), name='detail'), + re_path(r'^(?P[a-z0-9]+)/delete/$', views.DeletePreprintProvider.as_view(), name='delete'), + re_path(r'^(?P[a-z0-9]+)/export/$', views.ExportPreprintProvider.as_view(), name='export'), + re_path(r'^(?P[a-z0-9]+)/share_source/$', views.ShareSourcePreprintProvider.as_view(), name='share_source'), + re_path(r'^(?P[a-z0-9]+)/register/$', views.PreprintProviderRegisterModeratorOrAdmin.as_view(), name='register_moderator_admin'), + re_path(r'^(?P[a-z0-9]+)/edit/$', views.PreprintProviderChangeForm.as_view(), name='edit'), ] diff --git a/admin/preprints/urls.py b/admin/preprints/urls.py index 60bfc97c827..99091b75add 100644 --- a/admin/preprints/urls.py +++ b/admin/preprints/urls.py @@ -1,30 +1,30 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.preprints import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.PreprintSearchView.as_view(), name='search'), - url(r'^flagged_spam$', views.PreprintFlaggedSpamList.as_view(), name='flagged-spam'), - url(r'^known_spam$', views.PreprintKnownSpamList.as_view(), name='known-spam'), - url(r'^known_ham$', views.PreprintKnownHamList.as_view(), name='known-ham'), - url(r'^withdrawal_requests$', views.PreprintWithdrawalRequestList.as_view(), name='withdrawal-requests'), - url(r'^(?P[a-z0-9]+)/$', views.PreprintView.as_view(), name='preprint'), - url(r'^(?P[a-z0-9]+)/reindex_share_preprint/$', views.PreprintReindexShare.as_view(), + re_path(r'^$', views.PreprintSearchView.as_view(), name='search'), + re_path(r'^flagged_spam$', views.PreprintFlaggedSpamList.as_view(), name='flagged-spam'), + re_path(r'^known_spam$', views.PreprintKnownSpamList.as_view(), name='known-spam'), + re_path(r'^known_ham$', views.PreprintKnownHamList.as_view(), name='known-ham'), + re_path(r'^withdrawal_requests$', views.PreprintWithdrawalRequestList.as_view(), name='withdrawal-requests'), + re_path(r'^(?P[a-z0-9]+)/$', views.PreprintView.as_view(), name='preprint'), + re_path(r'^(?P[a-z0-9]+)/reindex_share_preprint/$', views.PreprintReindexShare.as_view(), name='reindex-share-preprint'), - url(r'^(?P[a-z0-9]+)/remove_user/(?P[a-z0-9]+)/$', views.PreprintRemoveContributorView.as_view(), + re_path(r'^(?P[a-z0-9]+)/remove_user/(?P[a-z0-9]+)/$', views.PreprintRemoveContributorView.as_view(), name='remove-user'), - url(r'^(?P[a-z0-9]+)/make_private/$', views.PreprintMakePrivate.as_view(), name='make-private'), - url(r'^(?P[a-z0-9]+)/make_public/$', views.PreprintMakePublic.as_view(), name='make-public'), - url(r'^(?P[a-z0-9]+)/remove/$', views.PreprintDeleteView.as_view(), name='remove'), - url(r'^(?P[a-z0-9]+)/restore/$', views.PreprintDeleteView.as_view(), name='restore'), - url(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.PreprintConfirmUnflagView.as_view(), name='confirm-unflag'), - url(r'^(?P[a-z0-9]+)/confirm_spam/$', views.PreprintConfirmSpamView.as_view(), name='confirm-spam'), - url(r'^(?P[a-z0-9]+)/confirm_ham/$', views.PreprintConfirmHamView.as_view(), name='confirm-ham'), - url(r'^(?P[a-z0-9]+)/reindex_elastic_preprint/$', views.PreprintReindexElastic.as_view(), + re_path(r'^(?P[a-z0-9]+)/make_private/$', views.PreprintMakePrivate.as_view(), name='make-private'), + re_path(r'^(?P[a-z0-9]+)/make_public/$', views.PreprintMakePublic.as_view(), name='make-public'), + re_path(r'^(?P[a-z0-9]+)/remove/$', views.PreprintDeleteView.as_view(), name='remove'), + re_path(r'^(?P[a-z0-9]+)/restore/$', views.PreprintDeleteView.as_view(), name='restore'), + re_path(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.PreprintConfirmUnflagView.as_view(), name='confirm-unflag'), + re_path(r'^(?P[a-z0-9]+)/confirm_spam/$', views.PreprintConfirmSpamView.as_view(), name='confirm-spam'), + re_path(r'^(?P[a-z0-9]+)/confirm_ham/$', views.PreprintConfirmHamView.as_view(), name='confirm-ham'), + re_path(r'^(?P[a-z0-9]+)/reindex_elastic_preprint/$', views.PreprintReindexElastic.as_view(), name='reindex-elastic-preprint'), - url(r'^(?P[a-z0-9]+)/approve_withdrawal/$', views.PreprintApproveWithdrawalRequest.as_view(), + re_path(r'^(?P[a-z0-9]+)/approve_withdrawal/$', views.PreprintApproveWithdrawalRequest.as_view(), name='approve-withdrawal'), - url(r'^(?P[a-z0-9]+)/reject_withdrawal/$', views.PreprintRejectWithdrawalRequest.as_view(), + re_path(r'^(?P[a-z0-9]+)/reject_withdrawal/$', views.PreprintRejectWithdrawalRequest.as_view(), name='reject-withdrawal'), ] diff --git a/admin/registration_providers/urls.py b/admin/registration_providers/urls.py index 0b736c9ec8a..7d319f632e0 100644 --- a/admin/registration_providers/urls.py +++ b/admin/registration_providers/urls.py @@ -1,20 +1,20 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^create/$', views.CreateRegistrationProvider.as_view(), name='create'), - url(r'^$', views.RegistrationProviderList.as_view(), name='list'), - url(r'^import/$', views.ImportRegistrationProvider.as_view(), name='import'), - url(r'^process_custom_taxonomy/$', views.ProcessCustomTaxonomy.as_view(), name='process_custom_taxonomy'), - url(r'^(?P[a-z0-9]+)/$', views.RegistrationProviderDetail.as_view(), name='detail'), - url(r'^(?P[a-z0-9]+)/delete/$', views.DeleteRegistrationProvider.as_view(), name='delete'), - url(r'^(?P[a-z0-9]+)/export/$', views.ExportRegistrationProvider.as_view(), name='export'), - url(r'^(?P[a-z0-9]+)/import/$', views.ImportRegistrationProvider.as_view(), name='import'), - url(r'^(?P[a-z0-9]+)/schemas/$', views.ChangeSchema.as_view(), name='schemas'), - url(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), - url(r'^(?P[a-z0-9]+)/share_source/$', views.ShareSourceRegistrationProvider.as_view(), name='share_source'), - url(r'^(?P[a-z0-9]+)/remove_admins_and_moderators/$', views.RemoveAdminsAndModerators.as_view(), name='remove_admins_and_moderators'), - url(r'^(?P[a-z0-9]+)/add_admin_or_moderator/$', views.AddAdminOrModerator.as_view(), name='add_admin_or_moderator'), + re_path(r'^create/$', views.CreateRegistrationProvider.as_view(), name='create'), + re_path(r'^$', views.RegistrationProviderList.as_view(), name='list'), + re_path(r'^import/$', views.ImportRegistrationProvider.as_view(), name='import'), + re_path(r'^process_custom_taxonomy/$', views.ProcessCustomTaxonomy.as_view(), name='process_custom_taxonomy'), + re_path(r'^(?P[a-z0-9]+)/$', views.RegistrationProviderDetail.as_view(), name='detail'), + re_path(r'^(?P[a-z0-9]+)/delete/$', views.DeleteRegistrationProvider.as_view(), name='delete'), + re_path(r'^(?P[a-z0-9]+)/export/$', views.ExportRegistrationProvider.as_view(), name='export'), + re_path(r'^(?P[a-z0-9]+)/import/$', views.ImportRegistrationProvider.as_view(), name='import'), + re_path(r'^(?P[a-z0-9]+)/schemas/$', views.ChangeSchema.as_view(), name='schemas'), + re_path(r'^(?P[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'), + re_path(r'^(?P[a-z0-9]+)/share_source/$', views.ShareSourceRegistrationProvider.as_view(), name='share_source'), + re_path(r'^(?P[a-z0-9]+)/remove_admins_and_moderators/$', views.RemoveAdminsAndModerators.as_view(), name='remove_admins_and_moderators'), + re_path(r'^(?P[a-z0-9]+)/add_admin_or_moderator/$', views.AddAdminOrModerator.as_view(), name='add_admin_or_moderator'), ] diff --git a/admin/registration_schemas/urls.py b/admin/registration_schemas/urls.py index f6d583d34fa..d0efa9f65c6 100644 --- a/admin/registration_schemas/urls.py +++ b/admin/registration_schemas/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.registration_schemas import views app_name = 'admin' urlpatterns = [ - url(r'^create/$', views.RegistrationSchemaCreateView.as_view(), name='create'), - url(r'^(?P[a-z0-9]+)/$', views.RegistrationSchemaDetailView.as_view(), name='detail'), - url(r'^(?P[a-z0-9]+)/delete/$$', views.RegistrationSchemaDeleteView.as_view(), name='remove'), - url(r'^$', views.RegistrationSchemaListView.as_view(), name='list'), + re_path(r'^create/$', views.RegistrationSchemaCreateView.as_view(), name='create'), + re_path(r'^(?P[a-z0-9]+)/$', views.RegistrationSchemaDetailView.as_view(), name='detail'), + re_path(r'^(?P[a-z0-9]+)/delete/$$', views.RegistrationSchemaDeleteView.as_view(), name='remove'), + re_path(r'^$', views.RegistrationSchemaListView.as_view(), name='list'), ] diff --git a/admin/schema_responses/urls.py b/admin/schema_responses/urls.py index 655a9ab0525..461435b2cfe 100644 --- a/admin/schema_responses/urls.py +++ b/admin/schema_responses/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from admin.schema_responses import views app_name = 'admin' urlpatterns = [ - url(r'^(?P[a-z0-9]+)/$', views.SchemaResponseDetailView.as_view(), name='detail'), - url(r'^$', views.SchemaResponseListView.as_view(), name='list'), + re_path(r'^(?P[a-z0-9]+)/$', views.SchemaResponseDetailView.as_view(), name='detail'), + re_path(r'^$', views.SchemaResponseListView.as_view(), name='list'), ] diff --git a/admin/subjects/urls.py b/admin/subjects/urls.py index bd4054a0729..e64251e08cd 100644 --- a/admin/subjects/urls.py +++ b/admin/subjects/urls.py @@ -1,13 +1,13 @@ from __future__ import absolute_import -from django.conf.urls import url +from django.conf.urls import re_path from admin.subjects import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.SubjectListView.as_view(), name='list'), - url(r'^(?P[0-9]+)/$', views.SubjectUpdateView.as_view(), + re_path(r'^$', views.SubjectListView.as_view(), name='list'), + re_path(r'^(?P[0-9]+)/$', views.SubjectUpdateView.as_view(), name='update'), ] diff --git a/admin/users/urls.py b/admin/users/urls.py index ee37a833626..7a524ae9f5d 100644 --- a/admin/users/urls.py +++ b/admin/users/urls.py @@ -1,29 +1,29 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'admin' urlpatterns = [ - url(r'^$', views.UserSearchView.as_view(), name='search'), - url(r'^flagged_spam$', views.UserFlaggedSpamList.as_view(), name='flagged-spam'), - url(r'^known_spam$', views.UserKnownSpamList.as_view(), name='known-spam'), - url(r'^known_ham$', views.UserKnownHamList.as_view(), name='known-ham'), - url(r'^search/(?P.*)/$', views.UserSearchList.as_view(), name='search-list'), - url(r'^(?P[a-z0-9]+)/$', views.UserView.as_view(), name='user'), - url(r'^(?P[a-z0-9]+)/reset-password/$', views.ResetPasswordView.as_view(), name='reset-password'), - url(r'^(?P[a-z0-9]+)/gdpr_delete/$', views.UserGDPRDeleteView.as_view(), name='GDPR-delete'), - url(r'^(?P[a-z0-9]+)/disable_spam/$', views.UserConfirmSpamView.as_view(), name='confirm-spam'), - url(r'^(?P[a-z0-9]+)/enable_ham/$', views.UserConfirmHamView.as_view(), name='confirm-ham'), - url(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.UserConfirmUnflagView.as_view(), name='confirm-unflag'), - url(r'^(?P[a-z0-9]+)/reactivate/$', views.UserDisableView.as_view(), name='reactivate'), - url(r'^(?P[a-z0-9]+)/disable/$', views.UserDisableView.as_view(), name='disable'), - url(r'^(?P[a-z0-9]+)/get_claim_urls/$', views.GetUserClaimLinks.as_view(), name='get-claim-urls'), - url(r'^(?P[a-z0-9]+)/two-factor/disable/$', views.User2FactorDeleteView.as_view(), name='remove2factor'), - url(r'^(?P[a-z0-9]+)/system_tags/add/$', views.UserAddSystemTag.as_view(), name='add-system-tag'), - url(r'^(?P[a-z0-9]+)/get_confirmation/$', views.GetUserConfirmationLink.as_view(), name='get-confirmation'), - url(r'^(?P[a-z0-9]+)/get_reset_password/$', views.GetPasswordResetLink.as_view(), name='get-reset-password'), - url(r'^(?P[a-z0-9]+)/reindex_elastic_user/$', views.UserReindexElastic.as_view(), + re_path(r'^$', views.UserSearchView.as_view(), name='search'), + re_path(r'^flagged_spam$', views.UserFlaggedSpamList.as_view(), name='flagged-spam'), + re_path(r'^known_spam$', views.UserKnownSpamList.as_view(), name='known-spam'), + re_path(r'^known_ham$', views.UserKnownHamList.as_view(), name='known-ham'), + re_path(r'^search/(?P.*)/$', views.UserSearchList.as_view(), name='search-list'), + re_path(r'^(?P[a-z0-9]+)/$', views.UserView.as_view(), name='user'), + re_path(r'^(?P[a-z0-9]+)/reset-password/$', views.ResetPasswordView.as_view(), name='reset-password'), + re_path(r'^(?P[a-z0-9]+)/gdpr_delete/$', views.UserGDPRDeleteView.as_view(), name='GDPR-delete'), + re_path(r'^(?P[a-z0-9]+)/disable_spam/$', views.UserConfirmSpamView.as_view(), name='confirm-spam'), + re_path(r'^(?P[a-z0-9]+)/enable_ham/$', views.UserConfirmHamView.as_view(), name='confirm-ham'), + re_path(r'^(?P[a-z0-9]+)/confirm_unflag/$', views.UserConfirmUnflagView.as_view(), name='confirm-unflag'), + re_path(r'^(?P[a-z0-9]+)/reactivate/$', views.UserDisableView.as_view(), name='reactivate'), + re_path(r'^(?P[a-z0-9]+)/disable/$', views.UserDisableView.as_view(), name='disable'), + re_path(r'^(?P[a-z0-9]+)/get_claim_urls/$', views.GetUserClaimLinks.as_view(), name='get-claim-urls'), + re_path(r'^(?P[a-z0-9]+)/two-factor/disable/$', views.User2FactorDeleteView.as_view(), name='remove2factor'), + re_path(r'^(?P[a-z0-9]+)/system_tags/add/$', views.UserAddSystemTag.as_view(), name='add-system-tag'), + re_path(r'^(?P[a-z0-9]+)/get_confirmation/$', views.GetUserConfirmationLink.as_view(), name='get-confirmation'), + re_path(r'^(?P[a-z0-9]+)/get_reset_password/$', views.GetPasswordResetLink.as_view(), name='get-reset-password'), + re_path(r'^(?P[a-z0-9]+)/reindex_elastic_user/$', views.UserReindexElastic.as_view(), name='reindex-elastic-user'), - url(r'^(?P[a-z0-9]+)/merge_accounts/$', views.UserMergeAccounts.as_view(), name='merge-accounts'), + re_path(r'^(?P[a-z0-9]+)/merge_accounts/$', views.UserMergeAccounts.as_view(), name='merge-accounts'), ] diff --git a/api/actions/urls.py b/api/actions/urls.py index bc6b7936633..237d95fa97a 100644 --- a/api/actions/urls.py +++ b/api/actions/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'osf' urlpatterns = [ - url(r'^reviews/$', views.ReviewActionListCreate.as_view(), name=views.ReviewActionListCreate.view_name), - url(r'^requests/nodes/$', views.NodeRequestActionCreate.as_view(), name=views.NodeRequestActionCreate.view_name), - url(r'^requests/preprints/$', views.PreprintRequestActionCreate.as_view(), name=views.NodeRequestActionCreate.view_name), - url(r'^(?P\w+)/$', views.ActionDetail.as_view(), name=views.ActionDetail.view_name), + re_path(r'^reviews/$', views.ReviewActionListCreate.as_view(), name=views.ReviewActionListCreate.view_name), + re_path(r'^requests/nodes/$', views.NodeRequestActionCreate.as_view(), name=views.NodeRequestActionCreate.view_name), + re_path(r'^requests/preprints/$', views.PreprintRequestActionCreate.as_view(), name=views.NodeRequestActionCreate.view_name), + re_path(r'^(?P\w+)/$', views.ActionDetail.as_view(), name=views.ActionDetail.view_name), ] diff --git a/api/addons/urls.py b/api/addons/urls.py index 8f04e68bc0b..033e2c77458 100644 --- a/api/addons/urls.py +++ b/api/addons/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.addons import views @@ -6,7 +6,7 @@ urlpatterns = [ # Examples: - # url(r'^$', 'api.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - url(r'^$', views.AddonList.as_view(), name=views.AddonList.view_name), + # re_path(r'^$', 'api.views.home', name='home'), + # re_path(r'^blog/', include('blog.urls')), + re_path(r'^$', views.AddonList.as_view(), name=views.AddonList.view_name), ] diff --git a/api/alerts/urls.py b/api/alerts/urls.py index 536de70e0eb..48b53dfac00 100644 --- a/api/alerts/urls.py +++ b/api/alerts/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views urlpatterns = [ - url(r'^$', views.DismissedAlertList.as_view(), name=views.DismissedAlertList.view_name), - url(r'^(?P<_id>\w+)/$', views.DismissedAlertDetail.as_view(), name=views.DismissedAlertDetail.view_name), + re_path(r'^$', views.DismissedAlertList.as_view(), name=views.DismissedAlertList.view_name), + re_path(r'^(?P<_id>\w+)/$', views.DismissedAlertDetail.as_view(), name=views.DismissedAlertDetail.view_name), ] diff --git a/api/applications/urls.py b/api/applications/urls.py index 5d1bfe538db..d9d9189762b 100644 --- a/api/applications/urls.py +++ b/api/applications/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.applications import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.ApplicationList.as_view(), name=views.ApplicationList.view_name), - url(r'^(?P\w+)/$', views.ApplicationDetail.as_view(), name=views.ApplicationDetail.view_name), - url(r'^(?P\w+)/reset/$', views.ApplicationReset.as_view(), name=views.ApplicationReset.view_name), + re_path(r'^$', views.ApplicationList.as_view(), name=views.ApplicationList.view_name), + re_path(r'^(?P\w+)/$', views.ApplicationDetail.as_view(), name=views.ApplicationDetail.view_name), + re_path(r'^(?P\w+)/reset/$', views.ApplicationReset.as_view(), name=views.ApplicationReset.view_name), ] diff --git a/api/banners/urls.py b/api/banners/urls.py index e37e3a5426c..f9b15ad82fd 100644 --- a/api/banners/urls.py +++ b/api/banners/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.banners import views app_name = 'osf' urlpatterns = [ - url(r'^current/$', views.CurrentBanner.as_view(), name=views.CurrentBanner.view_name), - url(r'^(?P[^/]+)/$', views.BannerMedia.as_view(), name=views.BannerMedia.view_name), + re_path(r'^current/$', views.CurrentBanner.as_view(), name=views.CurrentBanner.view_name), + re_path(r'^(?P[^/]+)/$', views.BannerMedia.as_view(), name=views.BannerMedia.view_name), ] diff --git a/api/base/settings/defaults.py b/api/base/settings/defaults.py index bc45ea5cd96..02537a60d0e 100644 --- a/api/base/settings/defaults.py +++ b/api/base/settings/defaults.py @@ -358,3 +358,4 @@ TRAVIS_ENV = False CITATION_STYLES_REPO_URL = 'https://github.com/CenterForOpenScience/styles/archive/88e6ed31a91e9f5a480b486029cda97b535935d4.zip' +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' diff --git a/api/base/urls.py b/api/base/urls.py index 52c79178ad6..e3273dd1ee6 100644 --- a/api/base/urls.py +++ b/api/base/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import include, url +from django.conf.urls import include, re_path from django.views.generic.base import RedirectView @@ -12,86 +12,86 @@ # Please keep URLs alphabetized for auto-generated documentation urlpatterns = [ - url( + re_path( r'^_/', include( [ - url(r'^', include('waffle.urls')), - url(r'^wb/', include('api.wb.urls', namespace='wb')), - url(r'^ia/', include('api.ia.urls', namespace='ia')), - url(r'^banners/', include('api.banners.urls', namespace='banners')), - url(r'^crossref/', include('api.crossref.urls', namespace='crossref')), - url(r'^chronos/', include('api.chronos.urls', namespace='chronos')), - url(r'^meetings/', include('api.meetings.urls', namespace='meetings')), - url(r'^metrics/', include('api.metrics.urls', namespace='metrics')), - url(r'^registries/(?P\w+)/bulk_create/(?P.*)/$', RegistrationBulkCreate.as_view(), name='bulk_create_csv'), + re_path(r'^', include('waffle.urls')), + re_path(r'^wb/', include('api.wb.urls', namespace='wb')), + re_path(r'^ia/', include('api.ia.urls', namespace='ia')), + re_path(r'^banners/', include('api.banners.urls', namespace='banners')), + re_path(r'^crossref/', include('api.crossref.urls', namespace='crossref')), + re_path(r'^chronos/', include('api.chronos.urls', namespace='chronos')), + re_path(r'^meetings/', include('api.meetings.urls', namespace='meetings')), + re_path(r'^metrics/', include('api.metrics.urls', namespace='metrics')), + re_path(r'^registries/(?P\w+)/bulk_create/(?P.*)/$', RegistrationBulkCreate.as_view(), name='bulk_create_csv'), ], ), ), - url( + re_path( '^(?P(v2))/', include( [ - url(r'^$', views.root, name='root'), - url(r'^status/', views.status_check, name='status_check'), - url(r'^actions/', include('api.actions.urls', namespace='actions')), - url(r'^addons/', include('api.addons.urls', namespace='addons')), - url(r'^alerts/', include(('api.alerts.urls', 'alerts'), namespace='alerts')), - url(r'^applications/', include('api.applications.urls', namespace='applications')), - url(r'^brands/', include('api.brands.urls', namespace='brands')), - url(r'^citations/', include('api.citations.urls', namespace='citations')), - url(r'^collections/', include('api.collections.urls', namespace='collections')), - url(r'^comments/', include('api.comments.urls', namespace='comments')), - url(r'^docs/', RedirectView.as_view(pattern_name=views.root), name='redirect-to-root', kwargs={'version': default_version}), - url(r'^draft_nodes/', include('api.draft_nodes.urls', namespace='draft_nodes')), - url(r'^draft_registrations/', include('api.draft_registrations.urls', namespace='draft_registrations')), - url(r'^files/', include('api.files.urls', namespace='files')), - url(r'^groups/', include('api.osf_groups.urls', namespace='groups')), - url(r'^guids/', include('api.guids.urls', namespace='guids')), - url(r'^identifiers/', include('api.identifiers.urls', namespace='identifiers')), - url(r'^institutions/', include('api.institutions.urls', namespace='institutions')), - url(r'^licenses/', include('api.licenses.urls', namespace='licenses')), - url(r'^logs/', include('api.logs.urls', namespace='logs')), - url(r'^metaschemas/', include('api.metaschemas.urls', namespace='metaschemas')), - url(r'^schemas/', include('api.schemas.urls', namespace='schemas')), - url(r'^nodes/', include('api.nodes.urls', namespace='nodes')), - url(r'^preprints/', include('api.preprints.urls', namespace='preprints')), - url(r'^preprint_providers/', include('api.preprint_providers.urls', namespace='preprint_providers')), - url(r'^providers/', include('api.providers.urls', namespace='providers')), - url(r'^regions/', include('api.regions.urls', namespace='regions')), - url(r'^registrations/', include('api.registrations.urls', namespace='registrations')), - url(r'^requests/', include(('api.requests.urls', 'requests'), namespace='requests')), - url(r'^resources/', include('api.resources.urls', namespace='resources')), - url(r'^scopes/', include('api.scopes.urls', namespace='scopes')), - url(r'^search/', include('api.search.urls', namespace='search')), - url(r'^sparse/', include('api.sparse.urls', namespace='sparse')), - url(r'^subjects/', include('api.subjects.urls', namespace='subjects')), - url(r'^subscriptions/', include('api.subscriptions.urls', namespace='subscriptions')), - url(r'^taxonomies/', include('api.taxonomies.urls', namespace='taxonomies')), - url(r'^test/', include('api.test.urls', namespace='test')), - url(r'^tokens/', include('api.tokens.urls', namespace='tokens')), - url(r'^users/', include('api.users.urls', namespace='users')), - url(r'^view_only_links/', include('api.view_only_links.urls', namespace='view-only-links')), - url(r'^wikis/', include('api.wikis.urls', namespace='wikis')), - url(r'^schema_responses/', include('api.schema_responses.urls', namespace='schema_responses')), - url(r'^_waffle/', include(('api.waffle.urls', 'waffle'), namespace='waffle')), + re_path(r'^$', views.root, name='root'), + re_path(r'^status/', views.status_check, name='status_check'), + re_path(r'^actions/', include('api.actions.urls', namespace='actions')), + re_path(r'^addons/', include('api.addons.urls', namespace='addons')), + re_path(r'^alerts/', include(('api.alerts.urls', 'alerts'), namespace='alerts')), + re_path(r'^applications/', include('api.applications.urls', namespace='applications')), + re_path(r'^brands/', include('api.brands.urls', namespace='brands')), + re_path(r'^citations/', include('api.citations.urls', namespace='citations')), + re_path(r'^collections/', include('api.collections.urls', namespace='collections')), + re_path(r'^comments/', include('api.comments.urls', namespace='comments')), + re_path(r'^docs/', RedirectView.as_view(pattern_name=views.root), name='redirect-to-root', kwargs={'version': default_version}), + re_path(r'^draft_nodes/', include('api.draft_nodes.urls', namespace='draft_nodes')), + re_path(r'^draft_registrations/', include('api.draft_registrations.urls', namespace='draft_registrations')), + re_path(r'^files/', include('api.files.urls', namespace='files')), + re_path(r'^groups/', include('api.osf_groups.urls', namespace='groups')), + re_path(r'^guids/', include('api.guids.urls', namespace='guids')), + re_path(r'^identifiers/', include('api.identifiers.urls', namespace='identifiers')), + re_path(r'^institutions/', include('api.institutions.urls', namespace='institutions')), + re_path(r'^licenses/', include('api.licenses.urls', namespace='licenses')), + re_path(r'^logs/', include('api.logs.urls', namespace='logs')), + re_path(r'^metaschemas/', include('api.metaschemas.urls', namespace='metaschemas')), + re_path(r'^schemas/', include('api.schemas.urls', namespace='schemas')), + re_path(r'^nodes/', include('api.nodes.urls', namespace='nodes')), + re_path(r'^preprints/', include('api.preprints.urls', namespace='preprints')), + re_path(r'^preprint_providers/', include('api.preprint_providers.urls', namespace='preprint_providers')), + re_path(r'^providers/', include('api.providers.urls', namespace='providers')), + re_path(r'^regions/', include('api.regions.urls', namespace='regions')), + re_path(r'^registrations/', include('api.registrations.urls', namespace='registrations')), + re_path(r'^requests/', include(('api.requests.urls', 'requests'), namespace='requests')), + re_path(r'^resources/', include('api.resources.urls', namespace='resources')), + re_path(r'^scopes/', include('api.scopes.urls', namespace='scopes')), + re_path(r'^search/', include('api.search.urls', namespace='search')), + re_path(r'^sparse/', include('api.sparse.urls', namespace='sparse')), + re_path(r'^subjects/', include('api.subjects.urls', namespace='subjects')), + re_path(r'^subscriptions/', include('api.subscriptions.urls', namespace='subscriptions')), + re_path(r'^taxonomies/', include('api.taxonomies.urls', namespace='taxonomies')), + re_path(r'^test/', include('api.test.urls', namespace='test')), + re_path(r'^tokens/', include('api.tokens.urls', namespace='tokens')), + re_path(r'^users/', include('api.users.urls', namespace='users')), + re_path(r'^view_only_links/', include('api.view_only_links.urls', namespace='view-only-links')), + re_path(r'^wikis/', include('api.wikis.urls', namespace='wikis')), + re_path(r'^schema_responses/', include('api.schema_responses.urls', namespace='schema_responses')), + re_path(r'^_waffle/', include(('api.waffle.urls', 'waffle'), namespace='waffle')), ], ), ), - url(r'^$', RedirectView.as_view(pattern_name=views.root), name='redirect-to-root', kwargs={'version': default_version}), + re_path(r'^$', RedirectView.as_view(pattern_name=views.root), name='redirect-to-root', kwargs={'version': default_version}), ] # Add django-silk URLs if it's in INSTALLED_APPS if 'silk' in settings.INSTALLED_APPS: urlpatterns += [ - url(r'^silk/', include('silk.urls', namespace='silk')), + re_path(r'^silk/', include('silk.urls', namespace='silk')), ] if settings.DEBUG: import debug_toolbar urlpatterns += [ - url(r'^__debug__/', include(debug_toolbar.urls)), + re_path(r'^__debug__/', include(debug_toolbar.urls)), ] diff --git a/api/brands/urls.py b/api/brands/urls.py index e9926a22c0c..a294788f0ad 100644 --- a/api/brands/urls.py +++ b/api/brands/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.brands import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.BrandList.as_view(), name=views.BrandList.view_name), - url(r'^(?P\w+)/$', views.BrandDetail.as_view(), name=views.BrandDetail.view_name), + re_path(r'^$', views.BrandList.as_view(), name=views.BrandList.view_name), + re_path(r'^(?P\w+)/$', views.BrandDetail.as_view(), name=views.BrandDetail.view_name), ] diff --git a/api/chronos/urls.py b/api/chronos/urls.py index 782678c6641..6fa831b69cc 100644 --- a/api/chronos/urls.py +++ b/api/chronos/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.chronos import views app_name = 'osf' urlpatterns = [ - url(r'^journals/$', views.ChronosJournalList.as_view(), name=views.ChronosJournalList.view_name), - url(r'^journals/(?P[-0-9A-Za-z]+)/$', views.ChronosJournalDetail.as_view(), name=views.ChronosJournalDetail.view_name), - url(r'^(?P\w+)/submissions/$', views.ChronosSubmissionList.as_view(), name=views.ChronosSubmissionList.view_name), - url(r'^(?P\w+)/submissions/(?P[-0-9A-Za-z]+)/$', views.ChronosSubmissionDetail.as_view(), name=views.ChronosSubmissionDetail.view_name), + re_path(r'^journals/$', views.ChronosJournalList.as_view(), name=views.ChronosJournalList.view_name), + re_path(r'^journals/(?P[-0-9A-Za-z]+)/$', views.ChronosJournalDetail.as_view(), name=views.ChronosJournalDetail.view_name), + re_path(r'^(?P\w+)/submissions/$', views.ChronosSubmissionList.as_view(), name=views.ChronosSubmissionList.view_name), + re_path(r'^(?P\w+)/submissions/(?P[-0-9A-Za-z]+)/$', views.ChronosSubmissionDetail.as_view(), name=views.ChronosSubmissionDetail.view_name), ] diff --git a/api/citations/urls.py b/api/citations/urls.py index a60e977c268..232e417d761 100644 --- a/api/citations/urls.py +++ b/api/citations/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.citations import views app_name = 'osf' urlpatterns = [ - url(r'^styles/$', views.CitationStyleList.as_view(), name=views.CitationStyleList.view_name), - url(r'^styles/(?P\w+)/$', views.CitationStyleDetail.as_view(), name=views.CitationStyleDetail.view_name), + re_path(r'^styles/$', views.CitationStyleList.as_view(), name=views.CitationStyleList.view_name), + re_path(r'^styles/(?P\w+)/$', views.CitationStyleDetail.as_view(), name=views.CitationStyleDetail.view_name), ] diff --git a/api/collections/urls.py b/api/collections/urls.py index 5fc62a500a4..cb04942721c 100644 --- a/api/collections/urls.py +++ b/api/collections/urls.py @@ -1,22 +1,22 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.collections import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.CollectionList.as_view(), name=views.CollectionList.view_name), - url(r'^(?P\w+)/$', views.CollectionDetail.as_view(), name=views.CollectionDetail.view_name), - url(r'^(?P\w+)/collected_metadata/$', views.CollectedMetaList.as_view(), name=views.CollectedMetaList.view_name), - url(r'^(?P\w+)/collected_metadata/(?P\w+)/$', views.CollectedMetaDetail.as_view(), name=views.CollectedMetaDetail.view_name), - url(r'^(?P\w+)/collected_metadata/(?P\w+)/subjects/$', views.CollectedMetaSubjectsList.as_view(), name=views.CollectedMetaSubjectsList.view_name), - url(r'^(?P\w+)/collected_metadata/(?P\w+)/relationships/subjects/$', views.CollectedMetaSubjectsRelationship.as_view(), name=views.CollectedMetaSubjectsRelationship.view_name), - url(r'^(?P\w+)/linked_nodes/$', views.LinkedNodesList.as_view(), name=views.LinkedNodesList.view_name), - url(r'^(?P\w+)/linked_preprints/$', views.LinkedPreprintsList.as_view(), name=views.LinkedPreprintsList.view_name), - url(r'^(?P\w+)/linked_registrations/$', views.LinkedRegistrationsList.as_view(), name=views.LinkedRegistrationsList.view_name), - url(r'^(?P\w+)/node_links/$', views.NodeLinksList.as_view(), name=views.NodeLinksList.view_name), - url(r'^(?P\w+)/node_links/(?P\w+)/', views.NodeLinksDetail.as_view(), name=views.NodeLinksDetail.view_name), - url(r'^(?P\w+)/relationships/linked_nodes/$', views.CollectionLinkedNodesRelationship.as_view(), name=views.CollectionLinkedNodesRelationship.view_name), - url(r'^(?P\w+)/relationships/linked_preprints/$', views.CollectionLinkedPreprintsRelationship.as_view(), name=views.CollectionLinkedPreprintsRelationship.view_name), - url(r'^(?P\w+)/relationships/linked_registrations/$', views.CollectionLinkedRegistrationsRelationship.as_view(), name=views.CollectionLinkedRegistrationsRelationship.view_name), + re_path(r'^$', views.CollectionList.as_view(), name=views.CollectionList.view_name), + re_path(r'^(?P\w+)/$', views.CollectionDetail.as_view(), name=views.CollectionDetail.view_name), + re_path(r'^(?P\w+)/collected_metadata/$', views.CollectedMetaList.as_view(), name=views.CollectedMetaList.view_name), + re_path(r'^(?P\w+)/collected_metadata/(?P\w+)/$', views.CollectedMetaDetail.as_view(), name=views.CollectedMetaDetail.view_name), + re_path(r'^(?P\w+)/collected_metadata/(?P\w+)/subjects/$', views.CollectedMetaSubjectsList.as_view(), name=views.CollectedMetaSubjectsList.view_name), + re_path(r'^(?P\w+)/collected_metadata/(?P\w+)/relationships/subjects/$', views.CollectedMetaSubjectsRelationship.as_view(), name=views.CollectedMetaSubjectsRelationship.view_name), + re_path(r'^(?P\w+)/linked_nodes/$', views.LinkedNodesList.as_view(), name=views.LinkedNodesList.view_name), + re_path(r'^(?P\w+)/linked_preprints/$', views.LinkedPreprintsList.as_view(), name=views.LinkedPreprintsList.view_name), + re_path(r'^(?P\w+)/linked_registrations/$', views.LinkedRegistrationsList.as_view(), name=views.LinkedRegistrationsList.view_name), + re_path(r'^(?P\w+)/node_links/$', views.NodeLinksList.as_view(), name=views.NodeLinksList.view_name), + re_path(r'^(?P\w+)/node_links/(?P\w+)/', views.NodeLinksDetail.as_view(), name=views.NodeLinksDetail.view_name), + re_path(r'^(?P\w+)/relationships/linked_nodes/$', views.CollectionLinkedNodesRelationship.as_view(), name=views.CollectionLinkedNodesRelationship.view_name), + re_path(r'^(?P\w+)/relationships/linked_preprints/$', views.CollectionLinkedPreprintsRelationship.as_view(), name=views.CollectionLinkedPreprintsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/linked_registrations/$', views.CollectionLinkedRegistrationsRelationship.as_view(), name=views.CollectionLinkedRegistrationsRelationship.view_name), ] diff --git a/api/comments/urls.py b/api/comments/urls.py index add20b8c627..74facb50368 100644 --- a/api/comments/urls.py +++ b/api/comments/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.comments import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.CommentDetail.as_view(), name=views.CommentDetail.view_name), - url(r'^(?P\w+)/reports/$', views.CommentReportsList.as_view(), name=views.CommentReportsList.view_name), - url(r'^(?P\w+)/reports/(?P\w+)/$', views.CommentReportDetail.as_view(), name=views.CommentReportDetail.view_name), + re_path(r'^(?P\w+)/$', views.CommentDetail.as_view(), name=views.CommentDetail.view_name), + re_path(r'^(?P\w+)/reports/$', views.CommentReportsList.as_view(), name=views.CommentReportsList.view_name), + re_path(r'^(?P\w+)/reports/(?P\w+)/$', views.CommentReportDetail.as_view(), name=views.CommentReportDetail.view_name), ] diff --git a/api/crossref/urls.py b/api/crossref/urls.py index fe8a6159417..c5b2629d11c 100644 --- a/api/crossref/urls.py +++ b/api/crossref/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.crossref import views app_name = 'osf' urlpatterns = [ - url(r'^email/$', views.ParseCrossRefConfirmation.as_view(), name=views.ParseCrossRefConfirmation.view_name), + re_path(r'^email/$', views.ParseCrossRefConfirmation.as_view(), name=views.ParseCrossRefConfirmation.view_name), ] diff --git a/api/draft_nodes/urls.py b/api/draft_nodes/urls.py index d83b998fe1e..7b69bc665bb 100644 --- a/api/draft_nodes/urls.py +++ b/api/draft_nodes/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.draft_nodes import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.DraftNodeDetail.as_view(), name=views.DraftNodeDetail.view_name), - url(r'^(?P\w+)/draft_registrations/$', views.DraftNodeDraftRegistrationsList.as_view(), name=views.DraftNodeDraftRegistrationsList.view_name), - url(r'^(?P\w+)/files/$', views.DraftNodeStorageProvidersList.as_view(), name=views.DraftNodeStorageProvidersList.view_name), - url(r'^(?P\w+)/files/providers/(?P\w+)/?$', views.DraftNodeStorageProviderDetail.as_view(), name=views.DraftNodeStorageProviderDetail.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.DraftNodeFilesList.as_view(), name=views.DraftNodeFilesList.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.DraftNodeFileDetail.as_view(), name=views.DraftNodeFileDetail.view_name), + re_path(r'^(?P\w+)/$', views.DraftNodeDetail.as_view(), name=views.DraftNodeDetail.view_name), + re_path(r'^(?P\w+)/draft_registrations/$', views.DraftNodeDraftRegistrationsList.as_view(), name=views.DraftNodeDraftRegistrationsList.view_name), + re_path(r'^(?P\w+)/files/$', views.DraftNodeStorageProvidersList.as_view(), name=views.DraftNodeStorageProvidersList.view_name), + re_path(r'^(?P\w+)/files/providers/(?P\w+)/?$', views.DraftNodeStorageProviderDetail.as_view(), name=views.DraftNodeStorageProviderDetail.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.DraftNodeFilesList.as_view(), name=views.DraftNodeFilesList.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.DraftNodeFileDetail.as_view(), name=views.DraftNodeFileDetail.view_name), ] diff --git a/api/draft_registrations/urls.py b/api/draft_registrations/urls.py index c400ef9595d..4066a5feaa7 100644 --- a/api/draft_registrations/urls.py +++ b/api/draft_registrations/urls.py @@ -1,17 +1,17 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.draft_registrations import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.DraftRegistrationList.as_view(), name=views.DraftRegistrationList.view_name), - url(r'^(?P\w+)/$', views.DraftRegistrationDetail.as_view(), name=views.DraftRegistrationDetail.view_name), - url(r'^(?P\w+)/contributors/$', views.DraftContributorsList.as_view(), name=views.DraftContributorsList.view_name), - url(r'^(?P\w+)/contributors/(?P\w+)/$', views.DraftContributorDetail.as_view(), name=views.DraftContributorDetail.view_name), - url(r'^(?P\w+)/bibliographic_contributors/$', views.DraftBibliographicContributorsList.as_view(), name=views.DraftBibliographicContributorsList.view_name), - url(r'^(?P\w+)/institutions/$', views.DraftInstitutionsList.as_view(), name=views.DraftInstitutionsList.view_name), - url(r'^(?P\w+)/relationships/institutions/$', views.DraftInstitutionsRelationship.as_view(), name=views.DraftInstitutionsRelationship.view_name), - url(r'^(?P\w+)/relationships/subjects/$', views.DraftSubjectsRelationship.as_view(), name=views.DraftSubjectsRelationship.view_name), - url(r'^(?P\w+)/subjects/$', views.DraftSubjectsList.as_view(), name=views.DraftSubjectsList.view_name), + re_path(r'^$', views.DraftRegistrationList.as_view(), name=views.DraftRegistrationList.view_name), + re_path(r'^(?P\w+)/$', views.DraftRegistrationDetail.as_view(), name=views.DraftRegistrationDetail.view_name), + re_path(r'^(?P\w+)/contributors/$', views.DraftContributorsList.as_view(), name=views.DraftContributorsList.view_name), + re_path(r'^(?P\w+)/contributors/(?P\w+)/$', views.DraftContributorDetail.as_view(), name=views.DraftContributorDetail.view_name), + re_path(r'^(?P\w+)/bibliographic_contributors/$', views.DraftBibliographicContributorsList.as_view(), name=views.DraftBibliographicContributorsList.view_name), + re_path(r'^(?P\w+)/institutions/$', views.DraftInstitutionsList.as_view(), name=views.DraftInstitutionsList.view_name), + re_path(r'^(?P\w+)/relationships/institutions/$', views.DraftInstitutionsRelationship.as_view(), name=views.DraftInstitutionsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/subjects/$', views.DraftSubjectsRelationship.as_view(), name=views.DraftSubjectsRelationship.view_name), + re_path(r'^(?P\w+)/subjects/$', views.DraftSubjectsList.as_view(), name=views.DraftSubjectsList.view_name), ] diff --git a/api/files/urls.py b/api/files/urls.py index e8bc165302c..7a94c232b5b 100644 --- a/api/files/urls.py +++ b/api/files/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.files import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.FileDetail.as_view(), name=views.FileDetail.view_name), - url(r'^(?P\w+)/versions/$', views.FileVersionsList.as_view(), name=views.FileVersionsList.view_name), - url(r'^(?P\w+)/versions/(?P\w+)/$', views.FileVersionDetail.as_view(), name=views.FileVersionDetail.view_name), - url(r'^(?P\w+)/metadata_records/$', views.FileMetadataRecordsList.as_view(), name=views.FileMetadataRecordsList.view_name), - url(r'^(?P\w+)/metadata_records/(?P\w+)/$', views.FileMetadataRecordDetail.as_view(), name=views.FileMetadataRecordDetail.view_name), - url(r'^(?P\w+)/metadata_records/(?P\w+)/download/$', views.FileMetadataRecordDownload.as_view(), name=views.FileMetadataRecordDownload.view_name), + re_path(r'^(?P\w+)/$', views.FileDetail.as_view(), name=views.FileDetail.view_name), + re_path(r'^(?P\w+)/versions/$', views.FileVersionsList.as_view(), name=views.FileVersionsList.view_name), + re_path(r'^(?P\w+)/versions/(?P\w+)/$', views.FileVersionDetail.as_view(), name=views.FileVersionDetail.view_name), + re_path(r'^(?P\w+)/metadata_records/$', views.FileMetadataRecordsList.as_view(), name=views.FileMetadataRecordsList.view_name), + re_path(r'^(?P\w+)/metadata_records/(?P\w+)/$', views.FileMetadataRecordDetail.as_view(), name=views.FileMetadataRecordDetail.view_name), + re_path(r'^(?P\w+)/metadata_records/(?P\w+)/download/$', views.FileMetadataRecordDownload.as_view(), name=views.FileMetadataRecordDownload.view_name), ] diff --git a/api/guids/urls.py b/api/guids/urls.py index 7d270ae80a0..58b2c549474 100644 --- a/api/guids/urls.py +++ b/api/guids/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.guids import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.GuidDetail.as_view(), name=views.GuidDetail.view_name), + re_path(r'^(?P\w+)/$', views.GuidDetail.as_view(), name=views.GuidDetail.view_name), ] diff --git a/api/ia/urls.py b/api/ia/urls.py index fea91896794..5b9b833e3ac 100644 --- a/api/ia/urls.py +++ b/api/ia/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.ia import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/done/', views.IACallbackView.as_view(), name=views.IACallbackView.view_name), + re_path(r'^(?P\w+)/done/', views.IACallbackView.as_view(), name=views.IACallbackView.view_name), ] diff --git a/api/identifiers/urls.py b/api/identifiers/urls.py index 65d28ca069a..509705c733a 100644 --- a/api/identifiers/urls.py +++ b/api/identifiers/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.identifiers import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.IdentifierDetail.as_view(), name=views.IdentifierDetail.view_name), - url(r'^(?P\w+)/identifiers/$', views.IdentifierList.as_view(), name=views.IdentifierList.view_name), + re_path(r'^(?P\w+)/$', views.IdentifierDetail.as_view(), name=views.IdentifierDetail.view_name), + re_path(r'^(?P\w+)/identifiers/$', views.IdentifierList.as_view(), name=views.IdentifierList.view_name), ] diff --git a/api/institutions/urls.py b/api/institutions/urls.py index ed7e29dc7fc..6e787ae571e 100644 --- a/api/institutions/urls.py +++ b/api/institutions/urls.py @@ -1,19 +1,19 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.institutions import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.InstitutionList.as_view(), name=views.InstitutionList.view_name), - url(r'^auth/$', views.InstitutionAuth.as_view(), name=views.InstitutionAuth.view_name), - url(r'^(?P\w+)/$', views.InstitutionDetail.as_view(), name=views.InstitutionDetail.view_name), - url(r'^(?P\w+)/nodes/$', views.InstitutionNodeList.as_view(), name=views.InstitutionNodeList.view_name), - url(r'^(?P\w+)/registrations/$', views.InstitutionRegistrationList.as_view(), name=views.InstitutionRegistrationList.view_name), - url(r'^(?P\w+)/relationships/registrations/$', views.InstitutionRegistrationsRelationship.as_view(), name=views.InstitutionRegistrationsRelationship.view_name), - url(r'^(?P\w+)/relationships/nodes/$', views.InstitutionNodesRelationship.as_view(), name=views.InstitutionNodesRelationship.view_name), - url(r'^(?P\w+)/users/$', views.InstitutionUserList.as_view(), name=views.InstitutionUserList.view_name), - url(r'^(?P\w+)/metrics/summary/$', views.InstitutionSummaryMetrics.as_view(), name=views.InstitutionSummaryMetrics.view_name), - url(r'^(?P\w+)/metrics/departments/$', views.InstitutionDepartmentList.as_view(), name=views.InstitutionDepartmentList.view_name), - url(r'^(?P\w+)/metrics/users/$', views.InstitutionUserMetricsList.as_view(), name=views.InstitutionUserMetricsList.view_name), + re_path(r'^$', views.InstitutionList.as_view(), name=views.InstitutionList.view_name), + re_path(r'^auth/$', views.InstitutionAuth.as_view(), name=views.InstitutionAuth.view_name), + re_path(r'^(?P\w+)/$', views.InstitutionDetail.as_view(), name=views.InstitutionDetail.view_name), + re_path(r'^(?P\w+)/nodes/$', views.InstitutionNodeList.as_view(), name=views.InstitutionNodeList.view_name), + re_path(r'^(?P\w+)/registrations/$', views.InstitutionRegistrationList.as_view(), name=views.InstitutionRegistrationList.view_name), + re_path(r'^(?P\w+)/relationships/registrations/$', views.InstitutionRegistrationsRelationship.as_view(), name=views.InstitutionRegistrationsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/nodes/$', views.InstitutionNodesRelationship.as_view(), name=views.InstitutionNodesRelationship.view_name), + re_path(r'^(?P\w+)/users/$', views.InstitutionUserList.as_view(), name=views.InstitutionUserList.view_name), + re_path(r'^(?P\w+)/metrics/summary/$', views.InstitutionSummaryMetrics.as_view(), name=views.InstitutionSummaryMetrics.view_name), + re_path(r'^(?P\w+)/metrics/departments/$', views.InstitutionDepartmentList.as_view(), name=views.InstitutionDepartmentList.view_name), + re_path(r'^(?P\w+)/metrics/users/$', views.InstitutionUserMetricsList.as_view(), name=views.InstitutionUserMetricsList.view_name), ] diff --git a/api/licenses/urls.py b/api/licenses/urls.py index dc89437a0fb..3068fb8bc44 100644 --- a/api/licenses/urls.py +++ b/api/licenses/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.licenses import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.LicenseList.as_view(), name=views.LicenseList.view_name), - url(r'^(?P\w+)/$', views.LicenseDetail.as_view(), name=views.LicenseDetail.view_name), + re_path(r'^$', views.LicenseList.as_view(), name=views.LicenseList.view_name), + re_path(r'^(?P\w+)/$', views.LicenseDetail.as_view(), name=views.LicenseDetail.view_name), ] diff --git a/api/logs/urls.py b/api/logs/urls.py index 5c0950afe96..d8a66aec148 100644 --- a/api/logs/urls.py +++ b/api/logs/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.logs import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.NodeLogDetail.as_view(), name=views.NodeLogDetail.view_name), + re_path(r'^(?P\w+)/$', views.NodeLogDetail.as_view(), name=views.NodeLogDetail.view_name), ] diff --git a/api/meetings/urls.py b/api/meetings/urls.py index b47d163c5e6..86a85a55b05 100644 --- a/api/meetings/urls.py +++ b/api/meetings/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.meetings import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.MeetingList.as_view(), name=views.MeetingList.view_name), - url(r'^(?P\w+)/$', views.MeetingDetail.as_view(), name=views.MeetingDetail.view_name), - url(r'^(?P\w+)/submissions/$', views.MeetingSubmissionList.as_view(), name=views.MeetingSubmissionList.view_name), - url(r'^(?P\w+)/submissions/(?P\w+)/$', views.MeetingSubmissionDetail.as_view(), name=views.MeetingSubmissionDetail.view_name), + re_path(r'^$', views.MeetingList.as_view(), name=views.MeetingList.view_name), + re_path(r'^(?P\w+)/$', views.MeetingDetail.as_view(), name=views.MeetingDetail.view_name), + re_path(r'^(?P\w+)/submissions/$', views.MeetingSubmissionList.as_view(), name=views.MeetingSubmissionList.view_name), + re_path(r'^(?P\w+)/submissions/(?P\w+)/$', views.MeetingSubmissionDetail.as_view(), name=views.MeetingSubmissionDetail.view_name), ] diff --git a/api/metaschemas/urls.py b/api/metaschemas/urls.py index f15709700aa..7b0af000eb3 100644 --- a/api/metaschemas/urls.py +++ b/api/metaschemas/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.metaschemas import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.DeprecatedMetaSchemasList.as_view(), name=views.DeprecatedMetaSchemasList.view_name), - url(r'^registrations/$', views.DeprecatedRegistrationMetaSchemaList.as_view(), name=views.DeprecatedRegistrationMetaSchemaList.view_name), - url(r'^(?P\w+)/$', views.DeprecatedMetaSchemaDetail.as_view(), name=views.DeprecatedMetaSchemaDetail.view_name), - url(r'^registrations/(?P\w+)/$', views.DeprecatedRegistrationMetaSchemaDetail.as_view(), name=views.DeprecatedRegistrationMetaSchemaDetail.view_name), + re_path(r'^$', views.DeprecatedMetaSchemasList.as_view(), name=views.DeprecatedMetaSchemasList.view_name), + re_path(r'^registrations/$', views.DeprecatedRegistrationMetaSchemaList.as_view(), name=views.DeprecatedRegistrationMetaSchemaList.view_name), + re_path(r'^(?P\w+)/$', views.DeprecatedMetaSchemaDetail.as_view(), name=views.DeprecatedMetaSchemaDetail.view_name), + re_path(r'^registrations/(?P\w+)/$', views.DeprecatedRegistrationMetaSchemaDetail.as_view(), name=views.DeprecatedRegistrationMetaSchemaDetail.view_name), ] diff --git a/api/metrics/urls.py b/api/metrics/urls.py index 7d5506e27d9..f98cd06616d 100644 --- a/api/metrics/urls.py +++ b/api/metrics/urls.py @@ -1,31 +1,31 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'osf' urlpatterns = [ - url(r'^raw/(?P[a-z0-9._/]*)$', views.RawMetricsView.as_view(), name=views.RawMetricsView.view_name), - url(r'^preprints/views/$', views.PreprintViewMetrics.as_view(), name=views.PreprintViewMetrics.view_name), - url(r'^preprints/downloads/$', views.PreprintDownloadMetrics.as_view(), name=views.PreprintDownloadMetrics.view_name), - url(r'^registries_moderation/transitions/$', views.RegistriesModerationMetricsView.as_view(), name=views.RegistriesModerationMetricsView.view_name), + re_path(r'^raw/(?P[a-z0-9._/]*)$', views.RawMetricsView.as_view(), name=views.RawMetricsView.view_name), + re_path(r'^preprints/views/$', views.PreprintViewMetrics.as_view(), name=views.PreprintViewMetrics.view_name), + re_path(r'^preprints/downloads/$', views.PreprintDownloadMetrics.as_view(), name=views.PreprintDownloadMetrics.view_name), + re_path(r'^registries_moderation/transitions/$', views.RegistriesModerationMetricsView.as_view(), name=views.RegistriesModerationMetricsView.view_name), - url( + re_path( r'^reports/$', views.ReportNameList.as_view(), name=views.ReportNameList.view_name, ), - url( + re_path( r'^reports/(?P[a-z0-9_]+)/recent/$', views.RecentReportList.as_view(), name=views.RecentReportList.view_name, ), - url( + re_path( r'^events/counted_usage/$', views.CountedUsageView.as_view(), name=views.CountedUsageView.view_name, ), - url( + re_path( r'^query/node_analytics/(?P[a-z0-9]+)/(?Pweek|fortnight|month)/$', views.NodeAnalyticsQuery.as_view(), name=views.NodeAnalyticsQuery.view_name, diff --git a/api/nodes/urls.py b/api/nodes/urls.py index cfe8fdf4a13..509118af0ed 100644 --- a/api/nodes/urls.py +++ b/api/nodes/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.nodes import views @@ -6,51 +6,51 @@ urlpatterns = [ # Examples: - # url(r'^$', 'api.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - url(r'^$', views.NodeList.as_view(), name=views.NodeList.view_name), - url(r'^(?P\w+)/$', views.NodeDetail.as_view(), name=views.NodeDetail.view_name), - url(r'^(?P\w+)/addons/$', views.NodeAddonList.as_view(), name=views.NodeAddonList.view_name), - url(r'^(?P\w+)/addons/(?P\w+)/$', views.NodeAddonDetail.as_view(), name=views.NodeAddonDetail.view_name), - url(r'^(?P\w+)/addons/(?P\w+)/folders/$', views.NodeAddonFolderList.as_view(), name=views.NodeAddonFolderList.view_name), - url(r'^(?P\w+)/bibliographic_contributors/$', views.NodeBibliographicContributorsList.as_view(), name=views.NodeBibliographicContributorsList.view_name), - url(r'^(?P\w+)/children/$', views.NodeChildrenList.as_view(), name=views.NodeChildrenList.view_name), - url(r'^(?P\w+)/citation/$', views.NodeCitationDetail.as_view(), name=views.NodeCitationDetail.view_name), - url(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.NodeCitationStyleDetail.as_view(), name=views.NodeCitationStyleDetail.view_name), - url(r'^(?P\w+)/comments/$', views.NodeCommentsList.as_view(), name=views.NodeCommentsList.view_name), - url(r'^(?P\w+)/contributors_and_group_members/$', views.NodeContributorsAndGroupMembersList.as_view(), name=views.NodeContributorsAndGroupMembersList.view_name), - url(r'^(?P\w+)/implicit_contributors/$', views.NodeImplicitContributorsList.as_view(), name=views.NodeImplicitContributorsList.view_name), - url(r'^(?P\w+)/contributors/$', views.NodeContributorsList.as_view(), name=views.NodeContributorsList.view_name), - url(r'^(?P\w+)/contributors/(?P\w+)/$', views.NodeContributorDetail.as_view(), name=views.NodeContributorDetail.view_name), - url(r'^(?P\w+)/draft_registrations/$', views.NodeDraftRegistrationsList.as_view(), name=views.NodeDraftRegistrationsList.view_name), - url(r'^(?P\w+)/draft_registrations/(?P\w+)/$', views.NodeDraftRegistrationDetail.as_view(), name=views.NodeDraftRegistrationDetail.view_name), - url(r'^(?P\w+)/files/$', views.NodeStorageProvidersList.as_view(), name=views.NodeStorageProvidersList.view_name), - url(r'^(?P\w+)/files/providers/(?P\w+)/?$', views.NodeStorageProviderDetail.as_view(), name=views.NodeStorageProviderDetail.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.NodeFilesList.as_view(), name=views.NodeFilesList.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.NodeFileDetail.as_view(), name=views.NodeFileDetail.view_name), - url(r'^(?P\w+)/forks/$', views.NodeForksList.as_view(), name=views.NodeForksList.view_name), - url(r'^(?P\w+)/groups/$', views.NodeGroupsList.as_view(), name=views.NodeGroupsList.view_name), - url(r'^(?P\w+)/groups/(?P\w+)/$', views.NodeGroupsDetail.as_view(), name=views.NodeGroupsDetail.view_name), - url(r'^(?P\w+)/identifiers/$', views.NodeIdentifierList.as_view(), name=views.NodeIdentifierList.view_name), - url(r'^(?P\w+)/institutions/$', views.NodeInstitutionsList.as_view(), name=views.NodeInstitutionsList.view_name), - url(r'^(?P\w+)/linked_nodes/$', views.LinkedNodesList.as_view(), name=views.LinkedNodesList.view_name), - url(r'^(?P\w+)/linked_registrations/$', views.NodeLinkedRegistrationsList.as_view(), name=views.NodeLinkedRegistrationsList.view_name), - url(r'^(?P\w+)/logs/$', views.NodeLogList.as_view(), name=views.NodeLogList.view_name), - url(r'^(?P\w+)/node_links/$', views.NodeLinksList.as_view(), name=views.NodeLinksList.view_name), - url(r'^(?P\w+)/node_links/(?P\w+)/', views.NodeLinksDetail.as_view(), name=views.NodeLinksDetail.view_name), - url(r'^(?P\w+)/linked_by_nodes/$', views.NodeLinkedByNodesList.as_view(), name=views.NodeLinkedByNodesList.view_name), - url(r'^(?P\w+)/linked_by_registrations/$', views.NodeLinkedByRegistrationsList.as_view(), name=views.NodeLinkedByRegistrationsList.view_name), - url(r'^(?P\w+)/preprints/$', views.NodePreprintsList.as_view(), name=views.NodePreprintsList.view_name), - url(r'^(?P\w+)/registrations/$', views.NodeRegistrationsList.as_view(), name=views.NodeRegistrationsList.view_name), - url(r'^(?P\w+)/relationships/institutions/$', views.NodeInstitutionsRelationship.as_view(), name=views.NodeInstitutionsRelationship.view_name), - url(r'^(?P\w+)/relationships/linked_nodes/$', views.NodeLinkedNodesRelationship.as_view(), name=views.NodeLinkedNodesRelationship.view_name), - url(r'^(?P\w+)/relationships/linked_registrations/$', views.NodeLinkedRegistrationsRelationship.as_view(), name=views.NodeLinkedRegistrationsRelationship.view_name), - url(r'^(?P\w+)/relationships/subjects/$', views.NodeSubjectsRelationship.as_view(), name=views.NodeSubjectsRelationship.view_name), - url(r'^(?P\w+)/requests/$', views.NodeRequestListCreate.as_view(), name=views.NodeRequestListCreate.view_name), - url(r'^(?P\w+)/settings/$', views.NodeSettings.as_view(), name=views.NodeSettings.view_name), - url(r'^(?P\w+)/storage/$', views.NodeStorage.as_view(), name=views.NodeStorage.view_name), - url(r'^(?P\w+)/subjects/$', views.NodeSubjectsList.as_view(), name=views.NodeSubjectsList.view_name), - url(r'^(?P\w+)/view_only_links/$', views.NodeViewOnlyLinksList.as_view(), name=views.NodeViewOnlyLinksList.view_name), - url(r'^(?P\w+)/view_only_links/(?P\w+)/$', views.NodeViewOnlyLinkDetail.as_view(), name=views.NodeViewOnlyLinkDetail.view_name), - url(r'^(?P\w+)/wikis/$', views.NodeWikiList.as_view(), name=views.NodeWikiList.view_name), + # re_path(r'^$', 'api.views.home', name='home'), + # re_path(r'^blog/', include('blog.urls')), + re_path(r'^$', views.NodeList.as_view(), name=views.NodeList.view_name), + re_path(r'^(?P\w+)/$', views.NodeDetail.as_view(), name=views.NodeDetail.view_name), + re_path(r'^(?P\w+)/addons/$', views.NodeAddonList.as_view(), name=views.NodeAddonList.view_name), + re_path(r'^(?P\w+)/addons/(?P\w+)/$', views.NodeAddonDetail.as_view(), name=views.NodeAddonDetail.view_name), + re_path(r'^(?P\w+)/addons/(?P\w+)/folders/$', views.NodeAddonFolderList.as_view(), name=views.NodeAddonFolderList.view_name), + re_path(r'^(?P\w+)/bibliographic_contributors/$', views.NodeBibliographicContributorsList.as_view(), name=views.NodeBibliographicContributorsList.view_name), + re_path(r'^(?P\w+)/children/$', views.NodeChildrenList.as_view(), name=views.NodeChildrenList.view_name), + re_path(r'^(?P\w+)/citation/$', views.NodeCitationDetail.as_view(), name=views.NodeCitationDetail.view_name), + re_path(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.NodeCitationStyleDetail.as_view(), name=views.NodeCitationStyleDetail.view_name), + re_path(r'^(?P\w+)/comments/$', views.NodeCommentsList.as_view(), name=views.NodeCommentsList.view_name), + re_path(r'^(?P\w+)/contributors_and_group_members/$', views.NodeContributorsAndGroupMembersList.as_view(), name=views.NodeContributorsAndGroupMembersList.view_name), + re_path(r'^(?P\w+)/implicit_contributors/$', views.NodeImplicitContributorsList.as_view(), name=views.NodeImplicitContributorsList.view_name), + re_path(r'^(?P\w+)/contributors/$', views.NodeContributorsList.as_view(), name=views.NodeContributorsList.view_name), + re_path(r'^(?P\w+)/contributors/(?P\w+)/$', views.NodeContributorDetail.as_view(), name=views.NodeContributorDetail.view_name), + re_path(r'^(?P\w+)/draft_registrations/$', views.NodeDraftRegistrationsList.as_view(), name=views.NodeDraftRegistrationsList.view_name), + re_path(r'^(?P\w+)/draft_registrations/(?P\w+)/$', views.NodeDraftRegistrationDetail.as_view(), name=views.NodeDraftRegistrationDetail.view_name), + re_path(r'^(?P\w+)/files/$', views.NodeStorageProvidersList.as_view(), name=views.NodeStorageProvidersList.view_name), + re_path(r'^(?P\w+)/files/providers/(?P\w+)/?$', views.NodeStorageProviderDetail.as_view(), name=views.NodeStorageProviderDetail.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.NodeFilesList.as_view(), name=views.NodeFilesList.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.NodeFileDetail.as_view(), name=views.NodeFileDetail.view_name), + re_path(r'^(?P\w+)/forks/$', views.NodeForksList.as_view(), name=views.NodeForksList.view_name), + re_path(r'^(?P\w+)/groups/$', views.NodeGroupsList.as_view(), name=views.NodeGroupsList.view_name), + re_path(r'^(?P\w+)/groups/(?P\w+)/$', views.NodeGroupsDetail.as_view(), name=views.NodeGroupsDetail.view_name), + re_path(r'^(?P\w+)/identifiers/$', views.NodeIdentifierList.as_view(), name=views.NodeIdentifierList.view_name), + re_path(r'^(?P\w+)/institutions/$', views.NodeInstitutionsList.as_view(), name=views.NodeInstitutionsList.view_name), + re_path(r'^(?P\w+)/linked_nodes/$', views.LinkedNodesList.as_view(), name=views.LinkedNodesList.view_name), + re_path(r'^(?P\w+)/linked_registrations/$', views.NodeLinkedRegistrationsList.as_view(), name=views.NodeLinkedRegistrationsList.view_name), + re_path(r'^(?P\w+)/logs/$', views.NodeLogList.as_view(), name=views.NodeLogList.view_name), + re_path(r'^(?P\w+)/node_links/$', views.NodeLinksList.as_view(), name=views.NodeLinksList.view_name), + re_path(r'^(?P\w+)/node_links/(?P\w+)/', views.NodeLinksDetail.as_view(), name=views.NodeLinksDetail.view_name), + re_path(r'^(?P\w+)/linked_by_nodes/$', views.NodeLinkedByNodesList.as_view(), name=views.NodeLinkedByNodesList.view_name), + re_path(r'^(?P\w+)/linked_by_registrations/$', views.NodeLinkedByRegistrationsList.as_view(), name=views.NodeLinkedByRegistrationsList.view_name), + re_path(r'^(?P\w+)/preprints/$', views.NodePreprintsList.as_view(), name=views.NodePreprintsList.view_name), + re_path(r'^(?P\w+)/registrations/$', views.NodeRegistrationsList.as_view(), name=views.NodeRegistrationsList.view_name), + re_path(r'^(?P\w+)/relationships/institutions/$', views.NodeInstitutionsRelationship.as_view(), name=views.NodeInstitutionsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/linked_nodes/$', views.NodeLinkedNodesRelationship.as_view(), name=views.NodeLinkedNodesRelationship.view_name), + re_path(r'^(?P\w+)/relationships/linked_registrations/$', views.NodeLinkedRegistrationsRelationship.as_view(), name=views.NodeLinkedRegistrationsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/subjects/$', views.NodeSubjectsRelationship.as_view(), name=views.NodeSubjectsRelationship.view_name), + re_path(r'^(?P\w+)/requests/$', views.NodeRequestListCreate.as_view(), name=views.NodeRequestListCreate.view_name), + re_path(r'^(?P\w+)/settings/$', views.NodeSettings.as_view(), name=views.NodeSettings.view_name), + re_path(r'^(?P\w+)/storage/$', views.NodeStorage.as_view(), name=views.NodeStorage.view_name), + re_path(r'^(?P\w+)/subjects/$', views.NodeSubjectsList.as_view(), name=views.NodeSubjectsList.view_name), + re_path(r'^(?P\w+)/view_only_links/$', views.NodeViewOnlyLinksList.as_view(), name=views.NodeViewOnlyLinksList.view_name), + re_path(r'^(?P\w+)/view_only_links/(?P\w+)/$', views.NodeViewOnlyLinkDetail.as_view(), name=views.NodeViewOnlyLinkDetail.view_name), + re_path(r'^(?P\w+)/wikis/$', views.NodeWikiList.as_view(), name=views.NodeWikiList.view_name), ] diff --git a/api/osf_groups/urls.py b/api/osf_groups/urls.py index d877198eb10..1277772e94a 100644 --- a/api/osf_groups/urls.py +++ b/api/osf_groups/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.osf_groups import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.GroupList.as_view(), name=views.GroupList.view_name), - url(r'^(?P\w+)/$', views.GroupDetail.as_view(), name=views.GroupDetail.view_name), - url(r'^(?P\w+)/members/$', views.GroupMembersList.as_view(), name=views.GroupMembersList.view_name), - url(r'^(?P\w+)/members/(?P\w+)/$', views.GroupMemberDetail.as_view(), name=views.GroupMemberDetail.view_name), + re_path(r'^$', views.GroupList.as_view(), name=views.GroupList.view_name), + re_path(r'^(?P\w+)/$', views.GroupDetail.as_view(), name=views.GroupDetail.view_name), + re_path(r'^(?P\w+)/members/$', views.GroupMembersList.as_view(), name=views.GroupMembersList.view_name), + re_path(r'^(?P\w+)/members/(?P\w+)/$', views.GroupMemberDetail.as_view(), name=views.GroupMemberDetail.view_name), ] diff --git a/api/preprint_providers/urls.py b/api/preprint_providers/urls.py index 19a5c980fe0..dd1fe7ee3f7 100644 --- a/api/preprint_providers/urls.py +++ b/api/preprint_providers/urls.py @@ -1,17 +1,17 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.preprint_providers import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.DeprecatedPreprintProviderList.as_view(), name=views.DeprecatedPreprintProviderList.view_name), - url(r'^(?P\w+)/$', views.DeprecatedPreprintProviderDetail.as_view(), name=views.DeprecatedPreprintProviderDetail.view_name), - url(r'^(?P\w+)/licenses/$', views.DeprecatedPreprintProviderLicenseList.as_view(), name=views.DeprecatedPreprintProviderLicenseList.view_name), - url(r'^(?P\w+)/preprints/$', views.DeprecatedPreprintProviderPreprintList.as_view(), name=views.DeprecatedPreprintProviderPreprintList.view_name), - url(r'^(?P\w+)/taxonomies/$', views.DeprecatedPreprintProviderTaxonomies.as_view(), name=views.DeprecatedPreprintProviderTaxonomies.view_name), - url(r'^(?P\w+)/taxonomies/highlighted/$', views.DeprecatedPreprintProviderHighlightedSubjectList.as_view(), name=views.DeprecatedPreprintProviderHighlightedSubjectList.view_name), - url(r'^(?P\w+)/moderators/$', views.DeprecatedPreprintProviderModeratorsList.as_view(), name=views.DeprecatedPreprintProviderModeratorsList.view_name), - url(r'^(?P\w+)/moderators/(?P\w+)/$', views.DeprecatedPreprintProviderModeratorsDetail.as_view(), name=views.DeprecatedPreprintProviderModeratorsDetail.view_name), + re_path(r'^$', views.DeprecatedPreprintProviderList.as_view(), name=views.DeprecatedPreprintProviderList.view_name), + re_path(r'^(?P\w+)/$', views.DeprecatedPreprintProviderDetail.as_view(), name=views.DeprecatedPreprintProviderDetail.view_name), + re_path(r'^(?P\w+)/licenses/$', views.DeprecatedPreprintProviderLicenseList.as_view(), name=views.DeprecatedPreprintProviderLicenseList.view_name), + re_path(r'^(?P\w+)/preprints/$', views.DeprecatedPreprintProviderPreprintList.as_view(), name=views.DeprecatedPreprintProviderPreprintList.view_name), + re_path(r'^(?P\w+)/taxonomies/$', views.DeprecatedPreprintProviderTaxonomies.as_view(), name=views.DeprecatedPreprintProviderTaxonomies.view_name), + re_path(r'^(?P\w+)/taxonomies/highlighted/$', views.DeprecatedPreprintProviderHighlightedSubjectList.as_view(), name=views.DeprecatedPreprintProviderHighlightedSubjectList.view_name), + re_path(r'^(?P\w+)/moderators/$', views.DeprecatedPreprintProviderModeratorsList.as_view(), name=views.DeprecatedPreprintProviderModeratorsList.view_name), + re_path(r'^(?P\w+)/moderators/(?P\w+)/$', views.DeprecatedPreprintProviderModeratorsDetail.as_view(), name=views.DeprecatedPreprintProviderModeratorsDetail.view_name), ] diff --git a/api/preprints/serializers.py b/api/preprints/serializers.py index 2a379d93bed..a93d8db3472 100644 --- a/api/preprints/serializers.py +++ b/api/preprints/serializers.py @@ -201,7 +201,7 @@ class PreprintSerializer(TaxonomizableSerializerMixin, MetricsSerializerMixin, J }, ) - has_coi = ser.NullBooleanField(required=False) + has_coi = ser.BooleanField(required=False, allow_null=True) conflict_of_interest_statement = ser.CharField(required=False, allow_blank=True, allow_null=True) has_data_links = ser.ChoiceField(Preprint.HAS_LINKS_CHOICES, required=False) why_no_data = ser.CharField(required=False, allow_blank=True, allow_null=True) diff --git a/api/preprints/urls.py b/api/preprints/urls.py index b6e2332d98b..70c72d991f6 100644 --- a/api/preprints/urls.py +++ b/api/preprints/urls.py @@ -1,22 +1,22 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.PreprintList.as_view(), name=views.PreprintList.view_name), - url(r'^(?P\w+)/$', views.PreprintDetail.as_view(), name=views.PreprintDetail.view_name), - url(r'^(?P\w+)/bibliographic_contributors/$', views.PreprintBibliographicContributorsList.as_view(), name=views.PreprintBibliographicContributorsList.view_name), - url(r'^(?P\w+)/citation/$', views.PreprintCitationDetail.as_view(), name=views.PreprintCitationDetail.view_name), - url(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.PreprintCitationStyleDetail.as_view(), name=views.PreprintCitationStyleDetail.view_name), - url(r'^(?P\w+)/contributors/$', views.PreprintContributorsList.as_view(), name=views.PreprintContributorsList.view_name), - url(r'^(?P\w+)/contributors/(?P\w+)/$', views.PreprintContributorDetail.as_view(), name=views.PreprintContributorDetail.view_name), - url(r'^(?P\w+)/files/$', views.PreprintStorageProvidersList.as_view(), name=views.PreprintStorageProvidersList.view_name), - url(r'^(?P\w+)/files/osfstorage/$', views.PreprintFilesList.as_view(), name=views.PreprintFilesList.view_name), - url(r'^(?P\w+)/identifiers/$', views.PreprintIdentifierList.as_view(), name=views.PreprintIdentifierList.view_name), - url(r'^(?P\w+)/relationships/node/$', views.PreprintNodeRelationship.as_view(), name=views.PreprintNodeRelationship.view_name), - url(r'^(?P\w+)/review_actions/$', views.PreprintActionList.as_view(), name=views.PreprintActionList.view_name), - url(r'^(?P\w+)/requests/$', views.PreprintRequestListCreate.as_view(), name=views.PreprintRequestListCreate.view_name), - url(r'^(?P\w+)/subjects/$', views.PreprintSubjectsList.as_view(), name=views.PreprintSubjectsList.view_name), + re_path(r'^$', views.PreprintList.as_view(), name=views.PreprintList.view_name), + re_path(r'^(?P\w+)/$', views.PreprintDetail.as_view(), name=views.PreprintDetail.view_name), + re_path(r'^(?P\w+)/bibliographic_contributors/$', views.PreprintBibliographicContributorsList.as_view(), name=views.PreprintBibliographicContributorsList.view_name), + re_path(r'^(?P\w+)/citation/$', views.PreprintCitationDetail.as_view(), name=views.PreprintCitationDetail.view_name), + re_path(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.PreprintCitationStyleDetail.as_view(), name=views.PreprintCitationStyleDetail.view_name), + re_path(r'^(?P\w+)/contributors/$', views.PreprintContributorsList.as_view(), name=views.PreprintContributorsList.view_name), + re_path(r'^(?P\w+)/contributors/(?P\w+)/$', views.PreprintContributorDetail.as_view(), name=views.PreprintContributorDetail.view_name), + re_path(r'^(?P\w+)/files/$', views.PreprintStorageProvidersList.as_view(), name=views.PreprintStorageProvidersList.view_name), + re_path(r'^(?P\w+)/files/osfstorage/$', views.PreprintFilesList.as_view(), name=views.PreprintFilesList.view_name), + re_path(r'^(?P\w+)/identifiers/$', views.PreprintIdentifierList.as_view(), name=views.PreprintIdentifierList.view_name), + re_path(r'^(?P\w+)/relationships/node/$', views.PreprintNodeRelationship.as_view(), name=views.PreprintNodeRelationship.view_name), + re_path(r'^(?P\w+)/review_actions/$', views.PreprintActionList.as_view(), name=views.PreprintActionList.view_name), + re_path(r'^(?P\w+)/requests/$', views.PreprintRequestListCreate.as_view(), name=views.PreprintRequestListCreate.view_name), + re_path(r'^(?P\w+)/subjects/$', views.PreprintSubjectsList.as_view(), name=views.PreprintSubjectsList.view_name), ] diff --git a/api/providers/urls.py b/api/providers/urls.py index 0bb2ef6b26b..a0c787d1c76 100644 --- a/api/providers/urls.py +++ b/api/providers/urls.py @@ -1,67 +1,67 @@ -from django.conf.urls import include, url +from django.conf.urls import include, re_path from api.providers import views app_name = 'osf' urlpatterns = [ - url( + re_path( r'^preprints/', include( ( [ - url(r'^$', views.PreprintProviderList.as_view(), name=views.PreprintProviderList.view_name), - url(r'^(?P\w+)/$', views.PreprintProviderDetail.as_view(), name=views.PreprintProviderDetail.view_name), - url(r'^(?P\w+)/licenses/$', views.PreprintProviderLicenseList.as_view(), name=views.PreprintProviderLicenseList.view_name), - url(r'^(?P\w+)/preprints/$', views.PreprintProviderPreprintList.as_view(), name=views.PreprintProviderPreprintList.view_name), - url(r'^(?P\w+)/subjects/$', views.PreprintProviderSubjects.as_view(), name=views.PreprintProviderSubjects.view_name), - url(r'^(?P\w+)/subjects/highlighted/$', views.PreprintProviderHighlightedSubjectList.as_view(), name=views.PreprintProviderHighlightedSubjectList.view_name), - url(r'^(?P\w+)/taxonomies/$', views.PreprintProviderTaxonomies.as_view(), name=views.PreprintProviderTaxonomies.view_name), - url(r'^(?P\w+)/taxonomies/highlighted/$', views.PreprintProviderHighlightedTaxonomyList.as_view(), name=views.PreprintProviderHighlightedTaxonomyList.view_name), - url(r'^(?P\w+)/withdraw_requests/$', views.PreprintProviderWithdrawRequestList.as_view(), name=views.PreprintProviderWithdrawRequestList.view_name), - url(r'^(?P\w+)/moderators/$', views.PreprintProviderModeratorsList.as_view(), name=views.PreprintProviderModeratorsList.view_name), - url(r'^(?P\w+)/moderators/(?P\w+)/$', views.PreprintProviderModeratorsDetail.as_view(), name=views.PreprintProviderModeratorsDetail.view_name), + re_path(r'^$', views.PreprintProviderList.as_view(), name=views.PreprintProviderList.view_name), + re_path(r'^(?P\w+)/$', views.PreprintProviderDetail.as_view(), name=views.PreprintProviderDetail.view_name), + re_path(r'^(?P\w+)/licenses/$', views.PreprintProviderLicenseList.as_view(), name=views.PreprintProviderLicenseList.view_name), + re_path(r'^(?P\w+)/preprints/$', views.PreprintProviderPreprintList.as_view(), name=views.PreprintProviderPreprintList.view_name), + re_path(r'^(?P\w+)/subjects/$', views.PreprintProviderSubjects.as_view(), name=views.PreprintProviderSubjects.view_name), + re_path(r'^(?P\w+)/subjects/highlighted/$', views.PreprintProviderHighlightedSubjectList.as_view(), name=views.PreprintProviderHighlightedSubjectList.view_name), + re_path(r'^(?P\w+)/taxonomies/$', views.PreprintProviderTaxonomies.as_view(), name=views.PreprintProviderTaxonomies.view_name), + re_path(r'^(?P\w+)/taxonomies/highlighted/$', views.PreprintProviderHighlightedTaxonomyList.as_view(), name=views.PreprintProviderHighlightedTaxonomyList.view_name), + re_path(r'^(?P\w+)/withdraw_requests/$', views.PreprintProviderWithdrawRequestList.as_view(), name=views.PreprintProviderWithdrawRequestList.view_name), + re_path(r'^(?P\w+)/moderators/$', views.PreprintProviderModeratorsList.as_view(), name=views.PreprintProviderModeratorsList.view_name), + re_path(r'^(?P\w+)/moderators/(?P\w+)/$', views.PreprintProviderModeratorsDetail.as_view(), name=views.PreprintProviderModeratorsDetail.view_name), ], 'preprints', ), namespace='preprint-providers', ), ), - url( + re_path( r'^collections/', include( ( [ - url(r'^$', views.CollectionProviderList.as_view(), name=views.CollectionProviderList.view_name), - url(r'^(?P\w+)/$', views.CollectionProviderDetail.as_view(), name=views.CollectionProviderDetail.view_name), - url(r'^(?P\w+)/licenses/$', views.CollectionProviderLicenseList.as_view(), name=views.CollectionProviderLicenseList.view_name), - url(r'^(?P\w+)/submissions/$', views.CollectionProviderSubmissionList.as_view(), name=views.CollectionProviderSubmissionList.view_name), - url(r'^(?P\w+)/subjects/$', views.CollectionProviderSubjects.as_view(), name=views.CollectionProviderSubjects.view_name), - url(r'^(?P\w+)/subjects/highlighted/$', views.CollectionProviderHighlightedSubjectList.as_view(), name=views.CollectionProviderHighlightedSubjectList.view_name), - url(r'^(?P\w+)/taxonomies/$', views.CollectionProviderTaxonomies.as_view(), name=views.CollectionProviderTaxonomies.view_name), - url(r'^(?P\w+)/taxonomies/highlighted/$', views.CollectionProviderHighlightedTaxonomyList.as_view(), name=views.CollectionProviderHighlightedTaxonomyList.view_name), + re_path(r'^$', views.CollectionProviderList.as_view(), name=views.CollectionProviderList.view_name), + re_path(r'^(?P\w+)/$', views.CollectionProviderDetail.as_view(), name=views.CollectionProviderDetail.view_name), + re_path(r'^(?P\w+)/licenses/$', views.CollectionProviderLicenseList.as_view(), name=views.CollectionProviderLicenseList.view_name), + re_path(r'^(?P\w+)/submissions/$', views.CollectionProviderSubmissionList.as_view(), name=views.CollectionProviderSubmissionList.view_name), + re_path(r'^(?P\w+)/subjects/$', views.CollectionProviderSubjects.as_view(), name=views.CollectionProviderSubjects.view_name), + re_path(r'^(?P\w+)/subjects/highlighted/$', views.CollectionProviderHighlightedSubjectList.as_view(), name=views.CollectionProviderHighlightedSubjectList.view_name), + re_path(r'^(?P\w+)/taxonomies/$', views.CollectionProviderTaxonomies.as_view(), name=views.CollectionProviderTaxonomies.view_name), + re_path(r'^(?P\w+)/taxonomies/highlighted/$', views.CollectionProviderHighlightedTaxonomyList.as_view(), name=views.CollectionProviderHighlightedTaxonomyList.view_name), ], 'collections', ), namespace='collection-providers', ), ), - url( + re_path( r'^registrations/', include( ( [ - url(r'^$', views.RegistrationProviderList.as_view(), name=views.RegistrationProviderList.view_name), - url(r'^(?P\w+)/$', views.RegistrationProviderDetail.as_view(), name=views.RegistrationProviderDetail.view_name), - url(r'^(?P\w+)/licenses/$', views.RegistrationProviderLicenseList.as_view(), name=views.RegistrationProviderLicenseList.view_name), - url(r'^(?P\w+)/schemas/$', views.RegistrationProviderSchemaList.as_view(), name=views.RegistrationProviderSchemaList.view_name), - url(r'^(?P\w+)/submissions/$', views.RegistrationProviderSubmissionList.as_view(), name=views.RegistrationProviderSubmissionList.view_name), - url(r'^(?P\w+)/subjects/$', views.RegistrationProviderSubjects.as_view(), name=views.RegistrationProviderSubjects.view_name), - url(r'^(?P\w+)/subjects/highlighted/$', views.RegistrationProviderHighlightedSubjectList.as_view(), name=views.RegistrationProviderHighlightedSubjectList.view_name), - url(r'^(?P\w+)/taxonomies/$', views.RegistrationProviderTaxonomies.as_view(), name=views.RegistrationProviderTaxonomies.view_name), - url(r'^(?P\w+)/taxonomies/highlighted/$', views.RegistrationProviderHighlightedTaxonomyList.as_view(), name=views.RegistrationProviderHighlightedTaxonomyList.view_name), - url(r'^(?P\w+)/requests/$', views.RegistrationProviderRequestList.as_view(), name=views.RegistrationProviderRequestList.view_name), - url(r'^(?P\w+)/registrations/$', views.RegistrationProviderRegistrationList.as_view(), name=views.RegistrationProviderRegistrationList.view_name), - url(r'^(?P\w+)/actions/$', views.RegistrationProviderActionList.as_view(), name=views.RegistrationProviderActionList.view_name), - url(r'^(?P\w+)/moderators/$', views.RegistrationProviderModeratorsList.as_view(), name=views.RegistrationProviderModeratorsList.view_name), - url(r'^(?P\w+)/moderators/(?P\w+)/$', views.RegistrationProviderModeratorsDetail.as_view(), name=views.RegistrationProviderModeratorsDetail.view_name), + re_path(r'^$', views.RegistrationProviderList.as_view(), name=views.RegistrationProviderList.view_name), + re_path(r'^(?P\w+)/$', views.RegistrationProviderDetail.as_view(), name=views.RegistrationProviderDetail.view_name), + re_path(r'^(?P\w+)/licenses/$', views.RegistrationProviderLicenseList.as_view(), name=views.RegistrationProviderLicenseList.view_name), + re_path(r'^(?P\w+)/schemas/$', views.RegistrationProviderSchemaList.as_view(), name=views.RegistrationProviderSchemaList.view_name), + re_path(r'^(?P\w+)/submissions/$', views.RegistrationProviderSubmissionList.as_view(), name=views.RegistrationProviderSubmissionList.view_name), + re_path(r'^(?P\w+)/subjects/$', views.RegistrationProviderSubjects.as_view(), name=views.RegistrationProviderSubjects.view_name), + re_path(r'^(?P\w+)/subjects/highlighted/$', views.RegistrationProviderHighlightedSubjectList.as_view(), name=views.RegistrationProviderHighlightedSubjectList.view_name), + re_path(r'^(?P\w+)/taxonomies/$', views.RegistrationProviderTaxonomies.as_view(), name=views.RegistrationProviderTaxonomies.view_name), + re_path(r'^(?P\w+)/taxonomies/highlighted/$', views.RegistrationProviderHighlightedTaxonomyList.as_view(), name=views.RegistrationProviderHighlightedTaxonomyList.view_name), + re_path(r'^(?P\w+)/requests/$', views.RegistrationProviderRequestList.as_view(), name=views.RegistrationProviderRequestList.view_name), + re_path(r'^(?P\w+)/registrations/$', views.RegistrationProviderRegistrationList.as_view(), name=views.RegistrationProviderRegistrationList.view_name), + re_path(r'^(?P\w+)/actions/$', views.RegistrationProviderActionList.as_view(), name=views.RegistrationProviderActionList.view_name), + re_path(r'^(?P\w+)/moderators/$', views.RegistrationProviderModeratorsList.as_view(), name=views.RegistrationProviderModeratorsList.view_name), + re_path(r'^(?P\w+)/moderators/(?P\w+)/$', views.RegistrationProviderModeratorsDetail.as_view(), name=views.RegistrationProviderModeratorsDetail.view_name), ], 'registrations', ), namespace='registration-providers', diff --git a/api/regions/urls.py b/api/regions/urls.py index c9fa96f5c26..2fc93caa590 100644 --- a/api/regions/urls.py +++ b/api/regions/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.regions import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.RegionList.as_view(), name=views.RegionList.view_name), - url(r'^(?P[-\w]+)/$', views.RegionDetail.as_view(), name=views.RegionDetail.view_name), + re_path(r'^$', views.RegionList.as_view(), name=views.RegionList.view_name), + re_path(r'^(?P[-\w]+)/$', views.RegionDetail.as_view(), name=views.RegionDetail.view_name), ] diff --git a/api/registrations/urls.py b/api/registrations/urls.py index 20d4ab3d5b7..8e61c684096 100644 --- a/api/registrations/urls.py +++ b/api/registrations/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.registrations import views from website import settings @@ -7,47 +7,47 @@ urlpatterns = [ # Examples: - # url(r'^$', 'api.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - url(r'^$', views.RegistrationList.as_view(), name=views.RegistrationList.view_name), - url(r'^(?P\w+)/$', views.RegistrationDetail.as_view(), name=views.RegistrationDetail.view_name), - url(r'^(?P\w+)/bibliographic_contributors/$', views.RegistrationBibliographicContributorsList.as_view(), name=views.RegistrationBibliographicContributorsList.view_name), - url(r'^(?P\w+)/children/$', views.RegistrationChildrenList.as_view(), name=views.RegistrationChildrenList.view_name), - url(r'^(?P\w+)/comments/$', views.RegistrationCommentsList.as_view(), name=views.RegistrationCommentsList.view_name), - url(r'^(?P\w+)/contributors/$', views.RegistrationContributorsList.as_view(), name=views.RegistrationContributorsList.view_name), - url(r'^(?P\w+)/contributors/(?P\w+)/$', views.RegistrationContributorDetail.as_view(), name=views.RegistrationContributorDetail.view_name), - url(r'^(?P\w+)/implicit_contributors/$', views.RegistrationImplicitContributorsList.as_view(), name=views.RegistrationImplicitContributorsList.view_name), - url(r'^(?P\w+)/files/$', views.RegistrationStorageProvidersList.as_view(), name=views.RegistrationStorageProvidersList.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.RegistrationFilesList.as_view(), name=views.RegistrationFilesList.view_name), - url(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.RegistrationFileDetail.as_view(), name=views.RegistrationFileDetail.view_name), - url(r'^(?P\w+)/citation/$', views.RegistrationCitationDetail.as_view(), name=views.RegistrationCitationDetail.view_name), - url(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.RegistrationCitationStyleDetail.as_view(), name=views.RegistrationCitationStyleDetail.view_name), - url(r'^(?P\w+)/forks/$', views.RegistrationForksList.as_view(), name=views.RegistrationForksList.view_name), - url(r'^(?P\w+)/identifiers/$', views.RegistrationIdentifierList.as_view(), name=views.RegistrationIdentifierList.view_name), - url(r'^(?P\w+)/institutions/$', views.RegistrationInstitutionsList.as_view(), name=views.RegistrationInstitutionsList.view_name), - url(r'^(?P\w+)/relationships/institutions/$', views.RegistrationInstitutionsRelationship.as_view(), name=views.RegistrationInstitutionsRelationship.view_name), - url(r'^(?P\w+)/relationships/subjects/$', views.RegistrationSubjectsRelationship.as_view(), name=views.RegistrationSubjectsRelationship.view_name), - url(r'^(?P\w+)/linked_nodes/$', views.RegistrationLinkedNodesList.as_view(), name=views.RegistrationLinkedNodesList.view_name), - url(r'^(?P\w+)/linked_registrations/$', views.RegistrationLinkedRegistrationsList.as_view(), name=views.RegistrationLinkedRegistrationsList.view_name), - url(r'^(?P\w+)/linked_by_nodes/$', views.RegistrationLinkedByNodesList.as_view(), name=views.RegistrationLinkedByNodesList.view_name), - url(r'^(?P\w+)/linked_by_registrations/$', views.RegistrationLinkedByRegistrationsList.as_view(), name=views.RegistrationLinkedByRegistrationsList.view_name), - url(r'^(?P\w+)/logs/$', views.RegistrationLogList.as_view(), name=views.RegistrationLogList.view_name), - url(r'^(?P\w+)/node_links/$', views.RegistrationNodeLinksList.as_view(), name=views.RegistrationNodeLinksList.view_name), - url(r'^(?P\w+)/node_links/(?P\w+)/', views.RegistrationNodeLinksDetail.as_view(), name=views.RegistrationNodeLinksDetail.view_name), - url(r'^(?P\w+)/relationships/linked_nodes/$', views.RegistrationLinkedNodesRelationship.as_view(), name=views.RegistrationLinkedNodesRelationship.view_name), - url(r'^(?P\w+)/relationships/linked_registrations/$', views.RegistrationLinkedRegistrationsRelationship.as_view(), name=views.RegistrationLinkedRegistrationsRelationship.view_name), - url(r'^(?P\w+)/subjects/$', views.RegistrationSubjectsList.as_view(), name=views.RegistrationSubjectsList.view_name), - url(r'^(?P\w+)/view_only_links/$', views.RegistrationViewOnlyLinksList.as_view(), name=views.RegistrationViewOnlyLinksList.view_name), - url(r'^(?P\w+)/view_only_links/(?P\w+)/$', views.RegistrationViewOnlyLinkDetail.as_view(), name=views.RegistrationViewOnlyLinkDetail.view_name), - url(r'^(?P\w+)/wikis/$', views.RegistrationWikiList.as_view(), name=views.RegistrationWikiList.view_name), - url(r'^(?P\w+)/actions/$', views.RegistrationActionList.as_view(), name=views.RegistrationActionList.view_name), - url(r'^(?P\w+)/requests/$', views.RegistrationRequestList.as_view(), name=views.RegistrationRequestList.view_name), - url(r'^(?P\w+)/schema_responses/$', views.RegistrationSchemaResponseList.as_view(), name=views.RegistrationSchemaResponseList.view_name), - url(r'^(?P\w+)/resources/$', views.RegistrationResourceList.as_view(), name=views.RegistrationResourceList.view_name), + # re_path(r'^$', 'api.views.home', name='home'), + # re_path(r'^blog/', include('blog.urls')), + re_path(r'^$', views.RegistrationList.as_view(), name=views.RegistrationList.view_name), + re_path(r'^(?P\w+)/$', views.RegistrationDetail.as_view(), name=views.RegistrationDetail.view_name), + re_path(r'^(?P\w+)/bibliographic_contributors/$', views.RegistrationBibliographicContributorsList.as_view(), name=views.RegistrationBibliographicContributorsList.view_name), + re_path(r'^(?P\w+)/children/$', views.RegistrationChildrenList.as_view(), name=views.RegistrationChildrenList.view_name), + re_path(r'^(?P\w+)/comments/$', views.RegistrationCommentsList.as_view(), name=views.RegistrationCommentsList.view_name), + re_path(r'^(?P\w+)/contributors/$', views.RegistrationContributorsList.as_view(), name=views.RegistrationContributorsList.view_name), + re_path(r'^(?P\w+)/contributors/(?P\w+)/$', views.RegistrationContributorDetail.as_view(), name=views.RegistrationContributorDetail.view_name), + re_path(r'^(?P\w+)/implicit_contributors/$', views.RegistrationImplicitContributorsList.as_view(), name=views.RegistrationImplicitContributorsList.view_name), + re_path(r'^(?P\w+)/files/$', views.RegistrationStorageProvidersList.as_view(), name=views.RegistrationStorageProvidersList.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/(?:.*/)?)$', views.RegistrationFilesList.as_view(), name=views.RegistrationFilesList.view_name), + re_path(r'^(?P\w+)/files/(?P\w+)(?P/.+[^/])$', views.RegistrationFileDetail.as_view(), name=views.RegistrationFileDetail.view_name), + re_path(r'^(?P\w+)/citation/$', views.RegistrationCitationDetail.as_view(), name=views.RegistrationCitationDetail.view_name), + re_path(r'^(?P\w+)/citation/(?P[-\w]+)/$', views.RegistrationCitationStyleDetail.as_view(), name=views.RegistrationCitationStyleDetail.view_name), + re_path(r'^(?P\w+)/forks/$', views.RegistrationForksList.as_view(), name=views.RegistrationForksList.view_name), + re_path(r'^(?P\w+)/identifiers/$', views.RegistrationIdentifierList.as_view(), name=views.RegistrationIdentifierList.view_name), + re_path(r'^(?P\w+)/institutions/$', views.RegistrationInstitutionsList.as_view(), name=views.RegistrationInstitutionsList.view_name), + re_path(r'^(?P\w+)/relationships/institutions/$', views.RegistrationInstitutionsRelationship.as_view(), name=views.RegistrationInstitutionsRelationship.view_name), + re_path(r'^(?P\w+)/relationships/subjects/$', views.RegistrationSubjectsRelationship.as_view(), name=views.RegistrationSubjectsRelationship.view_name), + re_path(r'^(?P\w+)/linked_nodes/$', views.RegistrationLinkedNodesList.as_view(), name=views.RegistrationLinkedNodesList.view_name), + re_path(r'^(?P\w+)/linked_registrations/$', views.RegistrationLinkedRegistrationsList.as_view(), name=views.RegistrationLinkedRegistrationsList.view_name), + re_path(r'^(?P\w+)/linked_by_nodes/$', views.RegistrationLinkedByNodesList.as_view(), name=views.RegistrationLinkedByNodesList.view_name), + re_path(r'^(?P\w+)/linked_by_registrations/$', views.RegistrationLinkedByRegistrationsList.as_view(), name=views.RegistrationLinkedByRegistrationsList.view_name), + re_path(r'^(?P\w+)/logs/$', views.RegistrationLogList.as_view(), name=views.RegistrationLogList.view_name), + re_path(r'^(?P\w+)/node_links/$', views.RegistrationNodeLinksList.as_view(), name=views.RegistrationNodeLinksList.view_name), + re_path(r'^(?P\w+)/node_links/(?P\w+)/', views.RegistrationNodeLinksDetail.as_view(), name=views.RegistrationNodeLinksDetail.view_name), + re_path(r'^(?P\w+)/relationships/linked_nodes/$', views.RegistrationLinkedNodesRelationship.as_view(), name=views.RegistrationLinkedNodesRelationship.view_name), + re_path(r'^(?P\w+)/relationships/linked_registrations/$', views.RegistrationLinkedRegistrationsRelationship.as_view(), name=views.RegistrationLinkedRegistrationsRelationship.view_name), + re_path(r'^(?P\w+)/subjects/$', views.RegistrationSubjectsList.as_view(), name=views.RegistrationSubjectsList.view_name), + re_path(r'^(?P\w+)/view_only_links/$', views.RegistrationViewOnlyLinksList.as_view(), name=views.RegistrationViewOnlyLinksList.view_name), + re_path(r'^(?P\w+)/view_only_links/(?P\w+)/$', views.RegistrationViewOnlyLinkDetail.as_view(), name=views.RegistrationViewOnlyLinkDetail.view_name), + re_path(r'^(?P\w+)/wikis/$', views.RegistrationWikiList.as_view(), name=views.RegistrationWikiList.view_name), + re_path(r'^(?P\w+)/actions/$', views.RegistrationActionList.as_view(), name=views.RegistrationActionList.view_name), + re_path(r'^(?P\w+)/requests/$', views.RegistrationRequestList.as_view(), name=views.RegistrationRequestList.view_name), + re_path(r'^(?P\w+)/schema_responses/$', views.RegistrationSchemaResponseList.as_view(), name=views.RegistrationSchemaResponseList.view_name), + re_path(r'^(?P\w+)/resources/$', views.RegistrationResourceList.as_view(), name=views.RegistrationResourceList.view_name), ] # Routes only active in local/staging environments if settings.DEV_MODE: urlpatterns.extend([ - url(r'^(?P\w+)/registrations/$', views.RegistrationRegistrationsList.as_view(), name=views.RegistrationRegistrationsList.view_name), + re_path(r'^(?P\w+)/registrations/$', views.RegistrationRegistrationsList.as_view(), name=views.RegistrationRegistrationsList.view_name), ]) diff --git a/api/requests/urls.py b/api/requests/urls.py index 9fc4a6747cc..5af0771a3a1 100644 --- a/api/requests/urls.py +++ b/api/requests/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views urlpatterns = [ - url(r'^(?P\w+)/$', views.RequestDetail.as_view(), name=views.RequestDetail.view_name), - url(r'^(?P\w+)/actions/$', views.RequestActionList.as_view(), name=views.RequestActionList.view_name), + re_path(r'^(?P\w+)/$', views.RequestDetail.as_view(), name=views.RequestDetail.view_name), + re_path(r'^(?P\w+)/actions/$', views.RequestActionList.as_view(), name=views.RequestActionList.view_name), ] diff --git a/api/resources/urls.py b/api/resources/urls.py index d46f7c1eb7f..e25a6143228 100644 --- a/api/resources/urls.py +++ b/api/resources/urls.py @@ -1,15 +1,15 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.resources import views app_name = 'osf' urlpatterns = [ - url( + re_path( r'^$', views.ResourceList.as_view(), name=views.ResourceList.view_name, ), - url( + re_path( r'^(?P\w+)/$', views.ResourceDetail.as_view(), name=views.ResourceDetail.view_name, diff --git a/api/schema_responses/urls.py b/api/schema_responses/urls.py index 3fe069aa737..60cd15677e6 100644 --- a/api/schema_responses/urls.py +++ b/api/schema_responses/urls.py @@ -1,23 +1,23 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.schema_responses import views app_name = 'osf' urlpatterns = [ - url( + re_path( r'^$', views.SchemaResponseList.as_view(), name=views.SchemaResponseList.view_name, ), - url( + re_path( r'^(?P\w+)/$', views.SchemaResponseDetail.as_view(), name=views.SchemaResponseDetail.view_name, ), - url( + re_path( r'^(?P\w+)/actions/$', views.SchemaResponseActionList.as_view(), name=views.SchemaResponseActionList.view_name, ), - url( + re_path( r'^(?P\w+)/actions/(?P\w+)/$', views.SchemaResponseActionDetail.as_view(), name=views.SchemaResponseActionDetail.view_name, ), diff --git a/api/schemas/urls.py b/api/schemas/urls.py index 9aa9c833596..782bf8e9525 100644 --- a/api/schemas/urls.py +++ b/api/schemas/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.schemas import views app_name = 'osf' urlpatterns = [ - url(r'^registrations/$', views.RegistrationSchemaList.as_view(), name=views.RegistrationSchemaList.view_name), - url(r'^registrations/(?P\w+)/$', views.RegistrationSchemaDetail.as_view(), name=views.RegistrationSchemaDetail.view_name), - url(r'^files/$', views.FileMetadataSchemaList.as_view(), name=views.FileMetadataSchemaList.view_name), - url(r'^files/(?P\w+)/$', views.FileMetadataSchemaDetail.as_view(), name=views.FileMetadataSchemaDetail.view_name), - url(r'^registrations/(?P\w+)/schema_blocks/$', views.RegistrationSchemaBlocks.as_view(), name=views.RegistrationSchemaBlocks.view_name), - url(r'^registrations/(?P\w+)/schema_blocks/(?P\w+)/$', views.RegistrationSchemaBlockDetail.as_view(), name=views.RegistrationSchemaBlockDetail.view_name), + re_path(r'^registrations/$', views.RegistrationSchemaList.as_view(), name=views.RegistrationSchemaList.view_name), + re_path(r'^registrations/(?P\w+)/$', views.RegistrationSchemaDetail.as_view(), name=views.RegistrationSchemaDetail.view_name), + re_path(r'^files/$', views.FileMetadataSchemaList.as_view(), name=views.FileMetadataSchemaList.view_name), + re_path(r'^files/(?P\w+)/$', views.FileMetadataSchemaDetail.as_view(), name=views.FileMetadataSchemaDetail.view_name), + re_path(r'^registrations/(?P\w+)/schema_blocks/$', views.RegistrationSchemaBlocks.as_view(), name=views.RegistrationSchemaBlocks.view_name), + re_path(r'^registrations/(?P\w+)/schema_blocks/(?P\w+)/$', views.RegistrationSchemaBlockDetail.as_view(), name=views.RegistrationSchemaBlockDetail.view_name), ] diff --git a/api/scopes/urls.py b/api/scopes/urls.py index f3228bdf1d1..278476b1ba6 100644 --- a/api/scopes/urls.py +++ b/api/scopes/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.scopes import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.ScopeList.as_view(), name=views.ScopeList.view_name), - url(r'^(?P[a-z0-9._]+)/$', views.ScopeDetail.as_view(), name=views.ScopeDetail.view_name), + re_path(r'^$', views.ScopeList.as_view(), name=views.ScopeList.view_name), + re_path(r'^(?P[a-z0-9._]+)/$', views.ScopeDetail.as_view(), name=views.ScopeDetail.view_name), ] diff --git a/api/search/urls.py b/api/search/urls.py index 7f1dad7a5bb..95ed8d05acb 100644 --- a/api/search/urls.py +++ b/api/search/urls.py @@ -1,19 +1,19 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.search import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.Search.as_view(), name=views.Search.view_name), - url(r'^components/$', views.SearchComponents.as_view(), name=views.SearchComponents.view_name), - url(r'^files/$', views.SearchFiles.as_view(), name=views.SearchFiles.view_name), - url(r'^projects/$', views.SearchProjects.as_view(), name=views.SearchProjects.view_name), - url(r'^registrations/$', views.SearchRegistrations.as_view(), name=views.SearchRegistrations.view_name), - url(r'^users/$', views.SearchUsers.as_view(), name=views.SearchUsers.view_name), - url(r'^institutions/$', views.SearchInstitutions.as_view(), name=views.SearchInstitutions.view_name), - url(r'^collections/$', views.SearchCollections.as_view(), name=views.SearchCollections.view_name), + re_path(r'^$', views.Search.as_view(), name=views.Search.view_name), + re_path(r'^components/$', views.SearchComponents.as_view(), name=views.SearchComponents.view_name), + re_path(r'^files/$', views.SearchFiles.as_view(), name=views.SearchFiles.view_name), + re_path(r'^projects/$', views.SearchProjects.as_view(), name=views.SearchProjects.view_name), + re_path(r'^registrations/$', views.SearchRegistrations.as_view(), name=views.SearchRegistrations.view_name), + re_path(r'^users/$', views.SearchUsers.as_view(), name=views.SearchUsers.view_name), + re_path(r'^institutions/$', views.SearchInstitutions.as_view(), name=views.SearchInstitutions.view_name), + re_path(r'^collections/$', views.SearchCollections.as_view(), name=views.SearchCollections.view_name), # not currently supported by v1, but should be supported by v2 - # url(r'^nodes/$', views.SearchProjects.as_view(), name=views.SearchProjects.view_name), + # re_path(r'^nodes/$', views.SearchProjects.as_view(), name=views.SearchProjects.view_name), ] diff --git a/api/sparse/urls.py b/api/sparse/urls.py index 16af5ce630a..15551a2e2a4 100644 --- a/api/sparse/urls.py +++ b/api/sparse/urls.py @@ -1,68 +1,68 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.sparse import views app_name = 'osf' urlpatterns = [ - url( + re_path( r'^nodes/$', views.SparseNodeList.as_view(), name=views.SparseNodeList.view_name, ), - url( + re_path( r'^nodes/(?P\w+)/$', views.SparseNodeDetail.as_view(), name=views.SparseNodeDetail.view_name, ), - url( + re_path( r'^nodes/(?P\w+)/children/$', views.SparseNodeChildrenList.as_view(), name=views.SparseNodeChildrenList.view_name, ), - url( + re_path( r'^nodes/(?P\w+)/linked_nodes/$', views.SparseLinkedNodesList.as_view(), name=views.SparseLinkedNodesList.view_name, ), - url( + re_path( r'^nodes/(?P\w+)/linked_registrations/$', views.SparseLinkedRegistrationsList.as_view(), name=views.SparseLinkedRegistrationsList.view_name, ), - url( + re_path( r'^registrations/$', views.SparseRegistrationList.as_view(), name=views.SparseRegistrationList.view_name, ), - url( + re_path( r'^registrations/(?P\w+)/$', views.SparseRegistrationDetail.as_view(), name=views.SparseRegistrationDetail.view_name, ), - url( + re_path( r'^registrations/(?P\w+)/children/$', views.SparseRegistrationChildrenList.as_view(), name=views.SparseRegistrationChildrenList.view_name, ), - url( + re_path( r'^registrations/(?P\w+)/linked_nodes/$', views.SparseLinkedNodesList.as_view(), name=views.SparseLinkedNodesList.view_name, ), - url( + re_path( r'^registrations/(?P\w+)/linked_registrations/$', views.SparseLinkedRegistrationsList.as_view(), name=views.SparseLinkedRegistrationsList.view_name, ), - url( + re_path( r'^users/(?P\w+)/nodes/$', views.SparseUserNodeList.as_view(), name=views.SparseUserNodeList.view_name, ), - url( + re_path( r'^users/(?P\w+)/registrations/$', views.SparseUserRegistrationList.as_view(), name=views.SparseUserRegistrationList.view_name, diff --git a/api/subjects/urls.py b/api/subjects/urls.py index ad76bd8125d..e80581e179d 100644 --- a/api/subjects/urls.py +++ b/api/subjects/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.subjects import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.SubjectDetail.as_view(), name=views.SubjectDetail.view_name), - url(r'^(?P\w+)/children/$', views.SubjectChildrenList.as_view(), name=views.SubjectChildrenList.view_name), + re_path(r'^(?P\w+)/$', views.SubjectDetail.as_view(), name=views.SubjectDetail.view_name), + re_path(r'^(?P\w+)/children/$', views.SubjectChildrenList.as_view(), name=views.SubjectChildrenList.view_name), ] diff --git a/api/subscriptions/urls.py b/api/subscriptions/urls.py index dee2fe75374..8ac729318c2 100644 --- a/api/subscriptions/urls.py +++ b/api/subscriptions/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.subscriptions import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.SubscriptionList.as_view(), name=views.SubscriptionList.view_name), - url(r'^(?P\w+)/$', views.SubscriptionDetail.as_view(), name=views.SubscriptionDetail.view_name), + re_path(r'^$', views.SubscriptionList.as_view(), name=views.SubscriptionList.view_name), + re_path(r'^(?P\w+)/$', views.SubscriptionDetail.as_view(), name=views.SubscriptionDetail.view_name), ] diff --git a/api/taxonomies/urls.py b/api/taxonomies/urls.py index 920d63c67e3..24d865b74eb 100644 --- a/api/taxonomies/urls.py +++ b/api/taxonomies/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.taxonomies import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.TaxonomyList.as_view(), name=views.TaxonomyList.view_name), - url(r'^(?P\w+)/$', views.TaxonomyDetail.as_view(), name=views.TaxonomyDetail.view_name), + re_path(r'^$', views.TaxonomyList.as_view(), name=views.TaxonomyList.view_name), + re_path(r'^(?P\w+)/$', views.TaxonomyDetail.as_view(), name=views.TaxonomyDetail.view_name), ] diff --git a/api/test/urls.py b/api/test/urls.py index 8d181292311..c4d1b265f39 100644 --- a/api/test/urls.py +++ b/api/test/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.test import views app_name = 'osf' urlpatterns = [ - url(r'^throttle/', views.test_throttling, name='test-throttling'), + re_path(r'^throttle/', views.test_throttling, name='test-throttling'), ] diff --git a/api/tokens/urls.py b/api/tokens/urls.py index a2f1672dc28..241388bec0f 100644 --- a/api/tokens/urls.py +++ b/api/tokens/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.tokens import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.TokenList.as_view(), name='token-list'), - url(r'^(?P<_id>\w+)/$', views.TokenDetail.as_view(), name='token-detail'), - url(r'^(?P<_id>\w+)/scopes/$', views.TokenScopesList.as_view(), name='token-scopes-list'), + re_path(r'^$', views.TokenList.as_view(), name='token-list'), + re_path(r'^(?P<_id>\w+)/$', views.TokenDetail.as_view(), name='token-detail'), + re_path(r'^(?P<_id>\w+)/scopes/$', views.TokenScopesList.as_view(), name='token-scopes-list'), ] diff --git a/api/users/urls.py b/api/users/urls.py index 009baf4927e..d6fea1d2737 100644 --- a/api/users/urls.py +++ b/api/users/urls.py @@ -1,29 +1,29 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views app_name = 'osf' urlpatterns = [ - url(r'^$', views.UserList.as_view(), name=views.UserList.view_name), - url(r'^(?P\w+)/$', views.UserDetail.as_view(), name=views.UserDetail.view_name), - url(r'^(?P\w+)/addons/$', views.UserAddonList.as_view(), name=views.UserAddonList.view_name), - url(r'^(?P\w+)/addons/(?P\w+)/$', views.UserAddonDetail.as_view(), name=views.UserAddonDetail.view_name), - url(r'^(?P\w+)/addons/(?P\w+)/accounts/$', views.UserAddonAccountList.as_view(), name=views.UserAddonAccountList.view_name), - url(r'^(?P\w+)/addons/(?P\w+)/accounts/(?P\w+)/$', views.UserAddonAccountDetail.as_view(), name=views.UserAddonAccountDetail.view_name), - url(r'^(?P\w+)/claim/$', views.ClaimUser.as_view(), name=views.ClaimUser.view_name), - url(r'^(?P\w+)/draft_registrations/$', views.UserDraftRegistrations.as_view(), name=views.UserDraftRegistrations.view_name), - url(r'^(?P\w+)/institutions/$', views.UserInstitutions.as_view(), name=views.UserInstitutions.view_name), - url(r'^(?P\w+)/nodes/$', views.UserNodes.as_view(), name=views.UserNodes.view_name), - url(r'^(?P\w+)/groups/$', views.UserGroups.as_view(), name=views.UserGroups.view_name), - url(r'^(?P\w+)/preprints/$', views.UserPreprints.as_view(), name=views.UserPreprints.view_name), - url(r'^(?P\w+)/registrations/$', views.UserRegistrations.as_view(), name=views.UserRegistrations.view_name), - url(r'^(?P\w+)/settings/$', views.UserSettings.as_view(), name=views.UserSettings.view_name), - url(r'^(?P\w+)/quickfiles/$', views.UserQuickFiles.as_view(), name=views.UserQuickFiles.view_name), - url(r'^(?P\w+)/relationships/institutions/$', views.UserInstitutionsRelationship.as_view(), name=views.UserInstitutionsRelationship.view_name), - url(r'^(?P\w+)/settings/emails/$', views.UserEmailsList.as_view(), name=views.UserEmailsList.view_name), - url(r'^(?P\w+)/settings/emails/(?P\w+)/$', views.UserEmailsDetail.as_view(), name=views.UserEmailsDetail.view_name), - url(r'^(?P\w+)/settings/identities/$', views.UserIdentitiesList.as_view(), name=views.UserIdentitiesList.view_name), - url(r'^(?P\w+)/settings/identities/(?P\w+)/$', views.UserIdentitiesDetail.as_view(), name=views.UserIdentitiesDetail.view_name), - url(r'^(?P\w+)/settings/export/$', views.UserAccountExport.as_view(), name=views.UserAccountExport.view_name), - url(r'^(?P\w+)/settings/password/$', views.UserChangePassword.as_view(), name=views.UserChangePassword.view_name), + re_path(r'^$', views.UserList.as_view(), name=views.UserList.view_name), + re_path(r'^(?P\w+)/$', views.UserDetail.as_view(), name=views.UserDetail.view_name), + re_path(r'^(?P\w+)/addons/$', views.UserAddonList.as_view(), name=views.UserAddonList.view_name), + re_path(r'^(?P\w+)/addons/(?P\w+)/$', views.UserAddonDetail.as_view(), name=views.UserAddonDetail.view_name), + re_path(r'^(?P\w+)/addons/(?P\w+)/accounts/$', views.UserAddonAccountList.as_view(), name=views.UserAddonAccountList.view_name), + re_path(r'^(?P\w+)/addons/(?P\w+)/accounts/(?P\w+)/$', views.UserAddonAccountDetail.as_view(), name=views.UserAddonAccountDetail.view_name), + re_path(r'^(?P\w+)/claim/$', views.ClaimUser.as_view(), name=views.ClaimUser.view_name), + re_path(r'^(?P\w+)/draft_registrations/$', views.UserDraftRegistrations.as_view(), name=views.UserDraftRegistrations.view_name), + re_path(r'^(?P\w+)/institutions/$', views.UserInstitutions.as_view(), name=views.UserInstitutions.view_name), + re_path(r'^(?P\w+)/nodes/$', views.UserNodes.as_view(), name=views.UserNodes.view_name), + re_path(r'^(?P\w+)/groups/$', views.UserGroups.as_view(), name=views.UserGroups.view_name), + re_path(r'^(?P\w+)/preprints/$', views.UserPreprints.as_view(), name=views.UserPreprints.view_name), + re_path(r'^(?P\w+)/registrations/$', views.UserRegistrations.as_view(), name=views.UserRegistrations.view_name), + re_path(r'^(?P\w+)/settings/$', views.UserSettings.as_view(), name=views.UserSettings.view_name), + re_path(r'^(?P\w+)/quickfiles/$', views.UserQuickFiles.as_view(), name=views.UserQuickFiles.view_name), + re_path(r'^(?P\w+)/relationships/institutions/$', views.UserInstitutionsRelationship.as_view(), name=views.UserInstitutionsRelationship.view_name), + re_path(r'^(?P\w+)/settings/emails/$', views.UserEmailsList.as_view(), name=views.UserEmailsList.view_name), + re_path(r'^(?P\w+)/settings/emails/(?P\w+)/$', views.UserEmailsDetail.as_view(), name=views.UserEmailsDetail.view_name), + re_path(r'^(?P\w+)/settings/identities/$', views.UserIdentitiesList.as_view(), name=views.UserIdentitiesList.view_name), + re_path(r'^(?P\w+)/settings/identities/(?P\w+)/$', views.UserIdentitiesDetail.as_view(), name=views.UserIdentitiesDetail.view_name), + re_path(r'^(?P\w+)/settings/export/$', views.UserAccountExport.as_view(), name=views.UserAccountExport.view_name), + re_path(r'^(?P\w+)/settings/password/$', views.UserChangePassword.as_view(), name=views.UserChangePassword.view_name), ] diff --git a/api/view_only_links/urls.py b/api/view_only_links/urls.py index 79da5d3bf83..42630cf976a 100644 --- a/api/view_only_links/urls.py +++ b/api/view_only_links/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.view_only_links import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.ViewOnlyLinkDetail.as_view(), name=views.ViewOnlyLinkDetail.view_name), - url(r'^(?P\w+)/nodes/$', views.ViewOnlyLinkNodes.as_view(), name=views.ViewOnlyLinkNodes.view_name), - url(r'^(?P\w+)/relationships/nodes/$', views.ViewOnlyLinkNodesRelationships.as_view(), name=views.ViewOnlyLinkNodesRelationships.view_name), + re_path(r'^(?P\w+)/$', views.ViewOnlyLinkDetail.as_view(), name=views.ViewOnlyLinkDetail.view_name), + re_path(r'^(?P\w+)/nodes/$', views.ViewOnlyLinkNodes.as_view(), name=views.ViewOnlyLinkNodes.view_name), + re_path(r'^(?P\w+)/relationships/nodes/$', views.ViewOnlyLinkNodesRelationships.as_view(), name=views.ViewOnlyLinkNodesRelationships.view_name), ] diff --git a/api/waffle/urls.py b/api/waffle/urls.py index 6bb86bcf02d..daf2beb69f1 100644 --- a/api/waffle/urls.py +++ b/api/waffle/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls import url +from django.conf.urls import re_path from . import views urlpatterns = [ - url(r'^$', views.WaffleList.as_view(), name=views.WaffleList.view_name), + re_path(r'^$', views.WaffleList.as_view(), name=views.WaffleList.view_name), ] diff --git a/api/wb/urls.py b/api/wb/urls.py index f203c57b899..1f50368e642 100644 --- a/api/wb/urls.py +++ b/api/wb/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.wb import views app_name = 'osf' urlpatterns = [ - url(r'^hooks/(?P\w+)/move/', views.MoveFileMetadataView.as_view(), name=views.MoveFileMetadataView.view_name), - url(r'^hooks/(?P\w+)/copy/', views.CopyFileMetadataView.as_view(), name=views.CopyFileMetadataView.view_name), + re_path(r'^hooks/(?P\w+)/move/', views.MoveFileMetadataView.as_view(), name=views.MoveFileMetadataView.view_name), + re_path(r'^hooks/(?P\w+)/copy/', views.CopyFileMetadataView.as_view(), name=views.CopyFileMetadataView.view_name), ] diff --git a/api/wikis/urls.py b/api/wikis/urls.py index 290f787f05a..34b7c540ace 100644 --- a/api/wikis/urls.py +++ b/api/wikis/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.conf.urls import re_path from api.wikis import views app_name = 'osf' urlpatterns = [ - url(r'^(?P\w+)/$', views.WikiDetail.as_view(), name=views.WikiDetail.view_name), - url(r'^(?P\w+)/content/$', views.WikiContent.as_view(), name=views.WikiContent.view_name), - url(r'^(?P\w+)/versions/$', views.WikiVersions.as_view(), name=views.WikiVersions.view_name), - url(r'^(?P\w+)/versions/(?P\w+)/$', views.WikiVersionDetail.as_view(), name=views.WikiVersionDetail.view_name), - url(r'^(?P\w+)/versions/(?P\w+)/content/$', views.WikiVersionContent.as_view(), name=views.WikiVersionContent.view_name), + re_path(r'^(?P\w+)/$', views.WikiDetail.as_view(), name=views.WikiDetail.view_name), + re_path(r'^(?P\w+)/content/$', views.WikiContent.as_view(), name=views.WikiContent.view_name), + re_path(r'^(?P\w+)/versions/$', views.WikiVersions.as_view(), name=views.WikiVersions.view_name), + re_path(r'^(?P\w+)/versions/(?P\w+)/$', views.WikiVersionDetail.as_view(), name=views.WikiVersionDetail.view_name), + re_path(r'^(?P\w+)/versions/(?P\w+)/content/$', views.WikiVersionContent.as_view(), name=views.WikiVersionContent.view_name), ] diff --git a/api_tests/preprints/views/test_preprint_detail.py b/api_tests/preprints/views/test_preprint_detail.py index dc2f61d2e3c..aca17d6901e 100644 --- a/api_tests/preprints/views/test_preprint_detail.py +++ b/api_tests/preprints/views/test_preprint_detail.py @@ -60,7 +60,7 @@ def preprint(self, user): @pytest.fixture() def preprint_pre_mod(self, user): - return PreprintFactory(provider__reviews_workflow='pre-moderation', is_published=False, creator=user) + return PreprintFactory(reviews_workflow='pre-moderation', is_published=False, creator=user) @pytest.fixture() def moderator(self, preprint_pre_mod): diff --git a/api_tests/preprints/views/test_preprint_list.py b/api_tests/preprints/views/test_preprint_list.py index 18287ced08e..b24b25c8683 100644 --- a/api_tests/preprints/views/test_preprint_list.py +++ b/api_tests/preprints/views/test_preprint_list.py @@ -236,7 +236,7 @@ def test_exclude_nodes_from_preprints_endpoint(self): assert_not_in(self.project._id, ids) def test_withdrawn_preprints_list(self): - pp = PreprintFactory(provider__reviews_workflow='pre-moderation', is_published=False, creator=self.user) + pp = PreprintFactory(reviews_workflow='pre-moderation', is_published=False, creator=self.user) pp.machine_state = 'pending' mod = AuthUserFactory() pp.provider.get_group('moderator').user_set.add(mod) diff --git a/osf/management/commands/backfill_egap_provider_metadata.py b/osf/management/commands/backfill_egap_provider_metadata.py deleted file mode 100644 index dd91f8a00ca..00000000000 --- a/osf/management/commands/backfill_egap_provider_metadata.py +++ /dev/null @@ -1,124 +0,0 @@ -from __future__ import unicode_literals - -from datetime import datetime as dt -import logging -import pytz - -from django.core.management.base import BaseCommand -from django.db.models import Max -from osf.models import Registration - -logger = logging.getLogger(__name__) - -# Historical context: -# https://github.com/CenterForOpenScience/osf.io/blob/50467ce8f156cea162666df6587614a7e95d4859/website/project/metadata/egap-registration.json -# https://github.com/CenterForOpenScience/osf.io/blob/50467ce8f156cea162666df6587614a7e95d4859/scripts/EGAP/egap-registration-3.json -EGAP_ID_KEY = 'q3' -EGAP_PUBLICATION_DATE_KEY = 'q4' -LAST_RELEVANT_VERSION = 3 - -WITH_OFFSET_DATE_FORMAT = '%Y-%m-%d %H:%M:%S %z' -NO_OFFSET_DATE_FORMAT = '%m/%d/%Y - %H:%M' -# ALL "Timestamp of Original Registration" values *should* match one of -# the above formats, but the following were encountered while running the script -DISCOVERED_DATE_FORMAT_1 = '%Y-%m-%d %H:%M:%S' -DISCOVERED_DATE_FORMAT_2 = '%Y-%m-%d' - -ALL_DATE_FORMATS = [ - WITH_OFFSET_DATE_FORMAT, - NO_OFFSET_DATE_FORMAT, - DISCOVERED_DATE_FORMAT_1, - DISCOVERED_DATE_FORMAT_2, -] - -def _get_date_registered(registration): - '''Try to parse the registration's "Timestamp of Original Registration" value with all known formats.''' - timestamp_string = registration.registration_responses.get(EGAP_PUBLICATION_DATE_KEY) - if not timestamp_string: - return None - - registered_date = None - for date_format in ALL_DATE_FORMATS: - try: - registered_date = dt.strptime(timestamp_string, date_format) - except ValueError: - continue - - # Could not successfully parse the date field - if registered_date is None: - raise ValueError( - f'Registration with id {registration._id} has un-parseable ' - f'"Timestamp of Original Registration" value: {timestamp_string}' - ) - - # Mimic behavior of import_EGAP script for consistency - if not registered_date.tzinfo: - registered_date = registered_date.replace(tzinfo=pytz.UTC) - return registered_date - -def backfill_egap_metadata(dry_run=False, batch_size=None): - egap_registrations = Registration.objects.annotate( - # "Max" is a stupid way to extract the schema_version because - # registered_schema is implemented as ManyToMany instead of FK - schema_version=Max('registered_schema__schema_version') - ).filter( - provider___id='egap', - additional_metadata=None, # JSON fields are weird - schema_version__lte=LAST_RELEVANT_VERSION - ) - if batch_size: - egap_registrations = egap_registrations[:batch_size] - count = egap_registrations.count() - - logger.info( - f'Backfilling EGAP ID and registered_date for {count} registrations' - ) - for registration in egap_registrations: - egap_id = registration.registration_responses.get(EGAP_ID_KEY) - if egap_id: - logger.info( - f'{"[DRY RUN]: " if dry_run else ""}' - f'Copying EGAP Registration ID {egap_id} to additional_metadata ' - f'for Registration with GUID {registration._id}' - ) - # Starting with None value for additional_metadata, so assign a new dict - registration.additional_metadata = {'EGAP Registration ID': egap_id} - - try: - egap_registration_date = _get_date_registered(registration) - except ValueError as e: - logger.info(e) - continue # Skip this registration but keep running - - if egap_registration_date is not None: - logger.info( - f'{"[DRY RUN]: " if dry_run else ""}' - 'Copying Timestamp or Original Registration to registered_date for ' - f'Registration with GUID {registration._id}' - ) - registration.registered_date = egap_registration_date - - if not dry_run: - registration.save() - return count - -class Command(BaseCommand): - def add_arguments(self, parser): - super(Command, self).add_arguments(parser) - parser.add_argument( - '--dry', - action='store_true', - dest='dry_run', - help='Dry run', - ) - - parser.add_argument( - '--batch_size', - type=int, - default=0 - ) - - def handle(self, *args, **options): - dry_run = options.get('dry_run') - batch_size = options.get('batch_size') - backfill_egap_metadata(dry_run=dry_run, batch_size=batch_size) diff --git a/osf/migrations/0005_django3_upgrade_fixes.py b/osf/migrations/0005_django3_upgrade_fixes.py new file mode 100644 index 00000000000..640633d41d4 --- /dev/null +++ b/osf/migrations/0005_django3_upgrade_fixes.py @@ -0,0 +1,73 @@ +# Generated by Django 3.2.15 on 2022-09-23 02:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osf', '0004_django3_upgrade_fixes'), + ] + + operations = [ + migrations.AlterField( + model_name='abstractnode', + name='access_requests_enabled', + field=models.BooleanField(db_index=True, default=True, null=True), + ), + migrations.AlterField( + model_name='abstractnode', + name='branched_from_node', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='abstractnode', + name='external_registration', + field=models.BooleanField(default=False, null=True), + ), + migrations.AlterField( + model_name='abstractnode', + name='registration_responses_migrated', + field=models.BooleanField(db_index=True, default=True, null=True), + ), + migrations.AlterField( + model_name='abstractprovider', + name='allow_bulk_uploads', + field=models.BooleanField(default=False, null=True), + ), + migrations.AlterField( + model_name='abstractprovider', + name='allow_updates', + field=models.BooleanField(default=False, null=True), + ), + migrations.AlterField( + model_name='abstractprovider', + name='bulk_upload_auto_approval', + field=models.BooleanField(default=False, null=True), + ), + migrations.AlterField( + model_name='abstractprovider', + name='reviews_comments_anonymous', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='abstractprovider', + name='reviews_comments_private', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='basefilenode', + name='is_root', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='draftregistration', + name='registration_responses_migrated', + field=models.BooleanField(db_index=True, default=True, null=True), + ), + migrations.AlterField( + model_name='preprint', + name='has_coi', + field=models.BooleanField(blank=True, null=True), + ), + ] diff --git a/osf/models/files.py b/osf/models/files.py index 00ac6505eee..4bd717b621e 100644 --- a/osf/models/files.py +++ b/osf/models/files.py @@ -309,13 +309,6 @@ def generate_waterbutler_url(self, **kwargs): **kwargs ) - def update_version_metadata(self, location, metadata): - try: - self.versions.get(location=location).update_metadata(metadata) - return - except ObjectDoesNotExist: - raise VersionNotFoundError(location) - def touch(self, auth_header, revision=None, **kwargs): """The bread and butter of File, collects metadata about self and creates versions and updates self when required. diff --git a/osf/models/mixins.py b/osf/models/mixins.py index cb6962ad868..f6b9621af7b 100644 --- a/osf/models/mixins.py +++ b/osf/models/mixins.py @@ -966,8 +966,8 @@ class Meta: abstract = True reviews_workflow = models.CharField(null=True, blank=True, max_length=15, choices=Workflows.choices()) - reviews_comments_private = models.NullBooleanField() - reviews_comments_anonymous = models.NullBooleanField() + reviews_comments_private = models.BooleanField(null=True, blank=True) + reviews_comments_anonymous = models.BooleanField(null=True, blank=True) DEFAULT_SUBSCRIPTIONS = ['new_pending_submissions'] @@ -2165,7 +2165,7 @@ class RegistrationResponseMixin(models.Model): Mixin to be shared between DraftRegistrations and Registrations. """ registration_responses = DateTimeAwareJSONField(default=dict, blank=True) - registration_responses_migrated = models.NullBooleanField(default=True, db_index=True) + registration_responses_migrated = models.BooleanField(null=True, default=True, db_index=True) def get_registration_metadata(self, schema): raise NotImplementedError() diff --git a/osf/models/node.py b/osf/models/node.py index ccc1d47c23b..157a8d5d19d 100644 --- a/osf/models/node.py +++ b/osf/models/node.py @@ -329,7 +329,7 @@ class AbstractNode(DirtyFieldsMixin, TypedModel, AddonModelMixin, IdentifierMixi is_fork = models.BooleanField(default=False, db_index=True) is_public = models.BooleanField(default=False, db_index=True) is_deleted = models.BooleanField(default=False, db_index=True) - access_requests_enabled = models.NullBooleanField(default=True, db_index=True) + access_requests_enabled = models.BooleanField(null=True, default=True, db_index=True) custom_citation = models.TextField(blank=True, null=True) diff --git a/osf/models/preprint.py b/osf/models/preprint.py index 32028eefa3a..157886e475f 100644 --- a/osf/models/preprint.py +++ b/osf/models/preprint.py @@ -206,7 +206,7 @@ class Preprint(DirtyFieldsMixin, GuidMixin, IdentifierMixin, ReviewableMixin, Ba blank=True, null=True, ) - has_coi = models.NullBooleanField( + has_coi = models.BooleanField( blank=True, null=True ) diff --git a/osf/models/provider.py b/osf/models/provider.py index 7791e7f7aed..02a17d2a453 100644 --- a/osf/models/provider.py +++ b/osf/models/provider.py @@ -287,9 +287,9 @@ class RegistrationProvider(AbstractProvider): # [{'field_name': 'foo'}, {'field_name': 'bar'}] additional_metadata_fields = DateTimeAwareJSONField(blank=True, null=True) default_schema = models.ForeignKey('osf.registrationschema', related_name='default_schema', null=True, blank=True, on_delete=models.SET_NULL) - bulk_upload_auto_approval = models.NullBooleanField(default=False) - allow_updates = models.NullBooleanField(default=False) - allow_bulk_uploads = models.NullBooleanField(default=False) + bulk_upload_auto_approval = models.BooleanField(null=True, default=False) + allow_updates = models.BooleanField(null=True, default=False) + allow_bulk_uploads = models.BooleanField(null=True, default=False) def __init__(self, *args, **kwargs): self._meta.get_field('share_publish_type').default = 'Registration' diff --git a/osf/models/registrations.py b/osf/models/registrations.py index bb0e7708e69..6cc3f84b85e 100644 --- a/osf/models/registrations.py +++ b/osf/models/registrations.py @@ -102,9 +102,7 @@ class Registration(AbstractNode): ) registered_date = NonNaiveDateTimeField(db_index=True, null=True, blank=True) - # This is a NullBooleanField because of inheritance issues with using a BooleanField - # TODO: Update to BooleanField(default=False, null=True) when Django is updated to >=2.1 - external_registration = models.NullBooleanField(default=False) + external_registration = models.BooleanField(null=True, default=False) registered_user = models.ForeignKey(OSFUser, related_name='related_to', on_delete=models.SET_NULL, @@ -136,7 +134,7 @@ class Registration(AbstractNode): null=True, blank=True, on_delete=models.SET_NULL) files_count = models.PositiveIntegerField(blank=True, null=True) - branched_from_node = models.NullBooleanField(blank=True, null=True) + branched_from_node = models.BooleanField(null=True, blank=True) moderation_state = models.CharField( max_length=30, diff --git a/osf_tests/factories.py b/osf_tests/factories.py index 96ff58976be..2842395a714 100644 --- a/osf_tests/factories.py +++ b/osf_tests/factories.py @@ -59,8 +59,7 @@ class UserFactory(DjangoModelFactory): fullname = factory.Sequence(lambda n: 'Freddie Mercury{0}'.format(n)) username = factory.LazyFunction(fake_email) - password = factory.PostGenerationMethodCall('set_password', - 'queenfan86') + password = factory.PostGenerationMethodCall('set_password', 'queenfan86', notify=False) is_registered = True date_confirmed = factory.Faker('date_time_this_decade', tzinfo=pytz.utc) merged_by = None @@ -467,6 +466,7 @@ def add_approval_step(reg): reg.files_count = reg.registered_from.files.filter(deleted_on__isnull=True).count() draft_registration.registered_node = reg draft_registration.save() + reg.creator = user # keep auth if passed reg.save() if has_doi: @@ -699,12 +699,18 @@ class Meta: creator = factory.SubFactory(AuthUserFactory) doi = factory.Sequence(lambda n: '10.123/{}'.format(n)) - provider = factory.SubFactory(PreprintProviderFactory) @classmethod def _build(cls, target_class, *args, **kwargs): creator = kwargs.pop('creator', None) or UserFactory() provider = kwargs.pop('provider', None) or PreprintProviderFactory() + + # pre Django 3 behavior + reviews_workflow = kwargs.pop('reviews_workflow', None) + if reviews_workflow: + provider.reviews_workflow = reviews_workflow + provider.save() + project = kwargs.pop('project', None) or None title = kwargs.pop('title', None) or 'Untitled' description = kwargs.pop('description', None) or 'None' diff --git a/osf_tests/management_commands/test_backfill_egap_metadata.py b/osf_tests/management_commands/test_backfill_egap_metadata.py deleted file mode 100644 index e5ab6c6697b..00000000000 --- a/osf_tests/management_commands/test_backfill_egap_metadata.py +++ /dev/null @@ -1,112 +0,0 @@ -import pytest - -from osf.management.commands.backfill_egap_provider_metadata import backfill_egap_metadata -from osf.management.commands.update_registration_schemas import update_registration_schemas -from osf.models import RegistrationSchema -from osf_tests.factories import RegistrationFactory, RegistrationProviderFactory - -EGAP_ID_SCHEMA_KEY = 'q3' -REGISTRATION_DATE_SCHEMA_KEY = 'q4' -OLDER_EGAP_ID = 'ABC123' -OLDER_TIMESTAMP = '2020-10-04 08:30:00 -0400' -OLDEST_EGAP_ID = 'XYZ789' -OLDEST_TIMESTAMP = '03/01/2011 - 22:00' - - -@pytest.mark.django_db -class TestMigrateEgapRegistrationMetadata: - - @pytest.fixture() - def egap(self): - return RegistrationProviderFactory(_id='egap') - - @pytest.fixture() - def older_registration(self, egap): - schema = RegistrationSchema.objects.get(name='EGAP Registration', schema_version=3) - registration = RegistrationFactory(schema=schema) - registration.provider = egap - registration.registration_responses[EGAP_ID_SCHEMA_KEY] = OLDER_EGAP_ID - registration.registration_responses[REGISTRATION_DATE_SCHEMA_KEY] = OLDER_TIMESTAMP - registration.save() - return registration - - @pytest.fixture() - def oldest_registration(self, egap): - schema = RegistrationSchema.objects.get(name='EGAP Registration', schema_version=2) - registration = RegistrationFactory(schema=schema) - registration.provider = egap - registration.registration_responses[EGAP_ID_SCHEMA_KEY] = OLDEST_EGAP_ID - registration.registration_responses[REGISTRATION_DATE_SCHEMA_KEY] = OLDEST_TIMESTAMP - registration.save() - return registration - - @pytest.fixture() - def newer_registration(self, egap): - try: - schema = RegistrationSchema.objects.get(name='EGAP Registration', schema_version=4) - except Exception: - update_registration_schemas() - schema = RegistrationSchema.objects.get(name='EGAP Registration', schema_version=4) - - registration = RegistrationFactory(schema=schema) - registration.provider = egap - registration.save() - return registration - - @pytest.fixture() - def non_egap_registration(self): - return RegistrationFactory() - - def test_backfill_egap_metadata( - self, newer_registration, older_registration, - oldest_registration, non_egap_registration): - assert older_registration.additional_metadata is None - assert oldest_registration.additional_metadata is None - - backfilled_registration_count = backfill_egap_metadata() - assert backfilled_registration_count == 2 - - newer_registration.refresh_from_db() - older_registration.refresh_from_db() - oldest_registration.refresh_from_db() - non_egap_registration.refresh_from_db() - - assert older_registration.additional_metadata['EGAP Registration ID'] == OLDER_EGAP_ID - # Automatically converted to UTC, apparently - expected_older_date_string = '2020-10-04 12:30:00' - assert older_registration.registered_date.strftime('%Y-%m-%d %H:%M:%S') == expected_older_date_string - - assert oldest_registration.additional_metadata['EGAP Registration ID'] == OLDEST_EGAP_ID - expected_oldest_date_string = '2011-03-01 22:00:00' - assert oldest_registration.registered_date.strftime('%Y-%m-%d %H:%M:%S') == expected_oldest_date_string - - # Should have been excluded based on version - assert newer_registration.additional_metadata is None - # Shold have been excluded based on provider - assert non_egap_registration.additional_metadata is None - - def test_backfill_egap_metadata_dry_run(self, older_registration, oldest_registration): - backfill_count = backfill_egap_metadata(dry_run=True) - assert backfill_count == 2 - - older_registration.refresh_from_db() - oldest_registration.refresh_from_db() - assert older_registration.additional_metadata is None - assert oldest_registration.additional_metadata is None - - def test_backfill_egap_metadata_ignores_updated_registrations( - self, older_registration, oldest_registration): - older_registration.additional_metadata = {'EGAP Registration ID': OLDER_EGAP_ID} - older_registration.save() - - backfill_count = backfill_egap_metadata() - assert backfill_count == 1 - - oldest_registration.refresh_from_db() - assert oldest_registration.additional_metadata['EGAP Registration ID'] == OLDEST_EGAP_ID - - assert backfill_egap_metadata() == 0 - - def test_backfill_egap_metadata_batch_size( - self, older_registration, oldest_registration): - assert backfill_egap_metadata(batch_size=1) == 1 diff --git a/osf_tests/test_guid_auto_include.py b/osf_tests/test_guid_auto_include.py deleted file mode 100644 index 25185d48036..00000000000 --- a/osf_tests/test_guid_auto_include.py +++ /dev/null @@ -1,174 +0,0 @@ -from django.utils import timezone - -import pytest -from django_bulk_update.helper import bulk_update - -from django.db.models import DateTimeField - -from osf_tests.factories import UserFactory, PreprintFactory, NodeFactory - - -@pytest.mark.django_db -class TestGuidAutoInclude: - guid_factories = [ - UserFactory, - PreprintFactory, - NodeFactory - ] - - @pytest.mark.parametrize('Factory', guid_factories) - def test_filter_object(self, Factory): - obj = Factory() - assert '__guids' in str(obj._meta.model.objects.filter(id=obj.id).query), 'Guids were not included in filter query for {}'.format(obj._meta.model.__name__) - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_all(self, Factory, django_assert_num_queries): - for _ in range(0, 5): - UserFactory() - with django_assert_num_queries(1): - wut = Factory._meta.model.objects.all() - for x in wut: - assert x._id is not None, 'Guid was None' - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_filter(self, Factory, django_assert_num_queries): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - new_ids = [o.id for o in objects] - with django_assert_num_queries(1): - - wut = Factory._meta.model.objects.filter(id__in=new_ids) - for x in wut: - assert x._id is not None, 'Guid was None' - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_filter_order_by(self, Factory, django_assert_num_queries): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - new_ids = [o.id for o in objects] - with django_assert_num_queries(1): - - wut = Factory._meta.model.objects.filter(id__in=new_ids).order_by('id') - for x in wut: - assert x._id is not None, 'Guid was None' - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_values(self, Factory, django_assert_num_queries): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - with django_assert_num_queries(1): - wut = Factory._meta.model.objects.values('id') - for x in wut: - assert len(x) == 1, 'Too many keys in values' - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_exclude(self, Factory, django_assert_num_queries): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - try: - dtfield = [x.name for x in objects[0]._meta.get_fields() if isinstance(x, DateTimeField)][0] - except IndexError: - pytest.skip('Thing doesn\'t have a DateTimeField') - - with django_assert_num_queries(1): - wut = Factory._meta.model.objects.exclude(**{dtfield: timezone.now()}) - for x in wut: - assert x._id is not None, 'Guid was None' - - @pytest.mark.parametrize('Factory', guid_factories) - def test_update_objects(self, Factory): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - new_ids = [o.id for o in objects] - try: - dtfield = [x.name for x in objects[0]._meta.get_fields() if isinstance(x, DateTimeField)][0] - except IndexError: - pytest.skip('Thing doesn\'t have a DateTimeField') - qs = objects[0]._meta.model.objects.filter(id__in=new_ids) - assert len(qs) > 0, 'No results returned' - try: - qs.update(**{dtfield: timezone.now()}) - except Exception as ex: - pytest.fail('Queryset update failed for {} with exception {}'.format(Factory._meta.model.__name__, ex)) - - @pytest.mark.parametrize('Factory', guid_factories) - def test_update_on_objects_filtered_by_guids(self, Factory): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - new__ids = [o._id for o in objects] - try: - dtfield = [x.name for x in objects[0]._meta.get_fields() if isinstance(x, DateTimeField)][0] - except IndexError: - pytest.skip('Thing doesn\'t have a DateTimeField') - qs = objects[0]._meta.model.objects.filter(guids___id__in=new__ids) - assert len(qs) > 0, 'No results returned' - try: - qs.update(**{dtfield: timezone.now()}) - except Exception as ex: - pytest.fail('Queryset update failed for {} with exception {}'.format(Factory._meta.model.__name__, ex)) - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_related_manager(self, Factory, django_assert_num_queries): - thing_with_contributors = Factory() - if not hasattr(thing_with_contributors, 'contributors'): - pytest.skip('Thing must have contributors') - try: - with django_assert_num_queries(1): - [x._id for x in thing_with_contributors.contributors.all()] - except Exception as ex: - pytest.fail('Related manager failed for {} with exception {}'.format(Factory._meta.model.__name__, ex)) - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_count_objects(self, Factory, django_assert_num_queries): - objects = [] - for _ in range(0, 5): - objects.append(Factory()) - new_ids = [o.id for o in objects] - with django_assert_num_queries(1): - qs = objects[0]._meta.model.objects.filter(id__in=new_ids) - count = qs.count() - assert count == len(objects) - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_bulk_create_objects(self, Factory, django_assert_num_queries): - objects = [] - Model = Factory._meta.model - kwargs = {} - if Factory == PreprintFactory: - # Don't try to save preprints on build when neither the subject nor provider have been saved - kwargs['finish'] = False - for _ in range(0, 5): - objects.append(Factory.build(**kwargs)) - with django_assert_num_queries(1): - things = Model.objects.bulk_create(objects) - assert len(things) == len(objects) - - @pytest.mark.parametrize('Factory', guid_factories) - @pytest.mark.django_assert_num_queries - def test_bulk_update_objects(self, Factory, django_assert_num_queries): - objects = [] - ids = range(0, 5) - for id in ids: - objects.append(Factory()) - try: - dtfield = [x.name for x in objects[0]._meta.get_fields() if isinstance(x, DateTimeField)][0] - except IndexError: - pytest.skip('Thing doesn\'t have a DateTimeField') - for obj in objects: - setattr(obj, dtfield, timezone.now()) - with django_assert_num_queries(1): - bulk_update(objects) diff --git a/osf_tests/test_include_queryset.py b/osf_tests/test_include_queryset.py deleted file mode 100644 index bd13132cf4b..00000000000 --- a/osf_tests/test_include_queryset.py +++ /dev/null @@ -1,64 +0,0 @@ -"""Tests for osf.utils.manager.IncludeQueryset""" -import pytest - -from framework.auth import Auth -from osf.models import Node -from osf_tests.factories import ProjectFactory, NodeFactory, UserFactory - - -pytestmark = pytest.mark.django_db - - -@pytest.fixture() -def create_n_nodes(): - def _create_n_nodes(n, roots=True): - return [ - ProjectFactory() if roots else NodeFactory() - for _ in range(n) - ] - return _create_n_nodes - -class TestIncludeQuerySet: - - @pytest.mark.django_assert_num_queries - def test_include_guids(self, create_n_nodes, django_assert_num_queries): - create_n_nodes(3) - # Confirm guids included automagically - with django_assert_num_queries(1): - for node in Node.objects.all(): - assert node._id is not None - with django_assert_num_queries(1): - for node in Node.objects.prefetch_related('guids').all(): - assert node._id is not None - - @pytest.mark.django_assert_num_queries - def test_include_guids_filter(self, create_n_nodes, django_assert_num_queries): - nodes = create_n_nodes(3) - nids = [e.id for e in nodes[:-1]] - - with django_assert_num_queries(1): - for node in Node.objects.prefetch_related('guids').filter(id__in=nids): - assert node._id is not None - - @pytest.mark.django_assert_num_queries - def test_include_root_guids(self, create_n_nodes, django_assert_num_queries): - nodes = create_n_nodes(3, roots=False) - - queryset = Node.objects.filter(id__in=[e.id for e in nodes]).prefetch_related('root__guids') - with django_assert_num_queries(1): - for node in queryset: - assert node.root._id is not None - - @pytest.mark.django_assert_num_queries - def test_include_contributor_user_guids(self, create_n_nodes, django_assert_num_queries): - nodes = create_n_nodes(3) - for node in nodes: - for _ in range(3): - contrib = UserFactory() - node.add_contributor(contrib, auth=Auth(node.creator), save=True) - - nodes = Node.objects.prefetch_related('contributor_set__user__guids').all() - for node in nodes: - with django_assert_num_queries(0): - for contributor in node.contributor_set.all(): - assert contributor.user._id is not None diff --git a/osf_tests/test_reviewable.py b/osf_tests/test_reviewable.py index 1c2d7c15637..e74f44b818f 100644 --- a/osf_tests/test_reviewable.py +++ b/osf_tests/test_reviewable.py @@ -11,7 +11,7 @@ class TestReviewable: @mock.patch('website.identifiers.utils.request_identifiers') def test_state_changes(self, _): user = AuthUserFactory() - preprint = PreprintFactory(provider__reviews_workflow='pre-moderation', is_published=False) + preprint = PreprintFactory(reviews_workflow='pre-moderation', is_published=False) assert preprint.machine_state == DefaultStates.INITIAL.value preprint.run_submit(user) diff --git a/tests/test_preprints.py b/tests/test_preprints.py index 709253e3a84..6493b66a3f0 100644 --- a/tests/test_preprints.py +++ b/tests/test_preprints.py @@ -2526,19 +2526,19 @@ def user(self): @pytest.fixture() def unpublished_preprint_pre_mod(self): - return PreprintFactory(provider__reviews_workflow='pre-moderation', is_published=False) + return PreprintFactory(reviews_workflow='pre-moderation', is_published=False) @pytest.fixture() def preprint_pre_mod(self): - return PreprintFactory(provider__reviews_workflow='pre-moderation') + return PreprintFactory(reviews_workflow='pre-moderation') @pytest.fixture() def unpublished_preprint_post_mod(self): - return PreprintFactory(provider__reviews_workflow='post-moderation', is_published=False) + return PreprintFactory(reviews_workflow='post-moderation', is_published=False) @pytest.fixture() def preprint_post_mod(self): - return PreprintFactory(provider__reviews_workflow='post-moderation') + return PreprintFactory(reviews_workflow='post-moderation') @pytest.fixture() def preprint(self): diff --git a/tests/test_websitefiles.py b/tests/test_websitefiles.py index a714108c821..c56941b0695 100644 --- a/tests/test_websitefiles.py +++ b/tests/test_websitefiles.py @@ -508,7 +508,12 @@ def test_get_version(self): file.get_version('3', required=True) def test_update_version_metadata(self): - v1 = models.FileVersion(identifier='1') + location = { + 'service': 'cloud', + 'folder': 'osf', + 'object': 'file', + } + v1 = models.FileVersion(identifier='1', location=location) v1.save() file = TestFile( @@ -520,14 +525,8 @@ def test_update_version_metadata(self): ) file.save() - file.add_version(v1) - file.update_version_metadata(None, {'size': 1337}) - - with assert_raises(exceptions.VersionNotFoundError): - file.update_version_metadata('3', {}) - v1.refresh_from_db() - assert_equal(v1.size, 1337) + assert v1 == file.versions.get() @mock.patch('osf.models.files.requests.get') def test_touch(self, mock_requests):