Skip to content

Commit

Permalink
Merge remote-tracking branch 'longze/the-rest-of-the-fixes-1' into fe…
Browse files Browse the repository at this point in the history
…ature/django_upgrade
  • Loading branch information
cslzchen committed Sep 23, 2022
2 parents fc895e8 + cb4264b commit cce3dd3
Show file tree
Hide file tree
Showing 91 changed files with 748 additions and 1,153 deletions.
5 changes: 4 additions & 1 deletion addons/osfstorage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down
4 changes: 0 additions & 4 deletions addons/osfstorage/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
10 changes: 5 additions & 5 deletions admin/asset_files/urls.py
Original file line number Diff line number Diff line change
@@ -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<asset_id>[0-9]+)/$', views.ProviderAssetFileDetail.as_view(), name='detail'),
url(r'^(?P<asset_id>[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<asset_id>[0-9]+)/$', views.ProviderAssetFileDetail.as_view(), name='detail'),
re_path(r'^(?P<asset_id>[0-9]+)/delete/$', views.ProviderAssetFileDelete.as_view(), name='delete'),
]
10 changes: 5 additions & 5 deletions admin/banners/urls.py
Original file line number Diff line number Diff line change
@@ -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<banner_id>[0-9]+)/$', views.BannerDetail.as_view(), name='detail'),
url(r'^(?P<banner_id>[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<banner_id>[0-9]+)/$', views.BannerDetail.as_view(), name='detail'),
re_path(r'^(?P<banner_id>[0-9]+)/delete/$', views.DeleteBanner.as_view(), name='delete'),
]
52 changes: 26 additions & 26 deletions admin/base/urls.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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')),
]),
),
]
Expand All @@ -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'
8 changes: 4 additions & 4 deletions admin/brands/urls.py
Original file line number Diff line number Diff line change
@@ -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<brand_id>[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<brand_id>[0-9]+)/$', views.BrandDetail.as_view(), name='detail'),
]
18 changes: 9 additions & 9 deletions admin/collection_providers/urls.py
Original file line number Diff line number Diff line change
@@ -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<collection_provider_id>[a-z0-9]+)/$', views.CollectionProviderDetail.as_view(), name='detail'),
url(r'^(?P<collection_provider_id>[a-z0-9]+)/delete/$', views.DeleteCollectionProvider.as_view(), name='delete'),
url(r'^(?P<collection_provider_id>[a-z0-9]+)/export/$', views.ExportColectionProvider.as_view(), name='export'),
url(r'^(?P<collection_provider_id>[a-z0-9]+)/import/$', views.ImportCollectionProvider.as_view(), name='import'),
url(r'^(?P<collection_provider_id>[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<collection_provider_id>[a-z0-9]+)/$', views.CollectionProviderDetail.as_view(), name='detail'),
re_path(r'^(?P<collection_provider_id>[a-z0-9]+)/delete/$', views.DeleteCollectionProvider.as_view(), name='delete'),
re_path(r'^(?P<collection_provider_id>[a-z0-9]+)/export/$', views.ExportColectionProvider.as_view(), name='export'),
re_path(r'^(?P<collection_provider_id>[a-z0-9]+)/import/$', views.ImportCollectionProvider.as_view(), name='import'),
re_path(r'^(?P<collection_provider_id>[a-z0-9]+)/cannot_delete/$', views.CannotDeleteProvider.as_view(), name='cannot_delete'),
]
10 changes: 5 additions & 5 deletions admin/comments/urls.py
Original file line number Diff line number Diff line change
@@ -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<comment_id>[a-z0-9]+)/$', views.CommentDetail.as_view(), name='comment-detail'),
url(r'^(?P<comment_id>[a-z0-9]+)/mark_spam/$', views.CommentSpamView.as_view(), name='mark-spam'),
url(r'^user/(?P<user_guid>[a-z0-9]+)/$', views.UserCommentList.as_view(), name='user-comment'),
re_path(r'^$', views.CommentList.as_view(), name='comments'),
re_path(r'^(?P<comment_id>[a-z0-9]+)/$', views.CommentDetail.as_view(), name='comment-detail'),
re_path(r'^(?P<comment_id>[a-z0-9]+)/mark_spam/$', views.CommentSpamView.as_view(), name='mark-spam'),
re_path(r'^user/(?P<user_guid>[a-z0-9]+)/$', views.UserCommentList.as_view(), name='user-comment'),
]
12 changes: 6 additions & 6 deletions admin/common_auth/urls.py
Original file line number Diff line number Diff line change
@@ -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'),
]
24 changes: 12 additions & 12 deletions admin/institutions/urls.py
Original file line number Diff line number Diff line change
@@ -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<institution_id>[0-9]+)/$', views.InstitutionDetail.as_view(), name='detail'),
url(r'^(?P<institution_id>[0-9]+)/export/$', views.InstitutionExport.as_view(), name='export'),
url(r'^(?P<institution_id>[0-9]+)/delete/$', views.DeleteInstitution.as_view(), name='delete'),
url(r'^(?P<institution_id>[0-9]+)/deactivate/$', views.DeactivateInstitution.as_view(), name='deactivate'),
url(r'^(?P<institution_id>[0-9]+)/reactivate/$', views.ReactivateInstitution.as_view(), name='reactivate'),
url(r'^(?P<institution_id>[0-9]+)/cannot_delete/$', views.CannotDeleteInstitution.as_view(), name='cannot_delete'),
url(r'^(?P<institution_id>[0-9]+)/nodes/$', views.InstitutionNodeList.as_view(), name='nodes'),
url(r'^(?P<institution_id>[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<institution_id>[0-9]+)/$', views.InstitutionDetail.as_view(), name='detail'),
re_path(r'^(?P<institution_id>[0-9]+)/export/$', views.InstitutionExport.as_view(), name='export'),
re_path(r'^(?P<institution_id>[0-9]+)/delete/$', views.DeleteInstitution.as_view(), name='delete'),
re_path(r'^(?P<institution_id>[0-9]+)/deactivate/$', views.DeactivateInstitution.as_view(), name='deactivate'),
re_path(r'^(?P<institution_id>[0-9]+)/reactivate/$', views.ReactivateInstitution.as_view(), name='reactivate'),
re_path(r'^(?P<institution_id>[0-9]+)/cannot_delete/$', views.CannotDeleteInstitution.as_view(), name='cannot_delete'),
re_path(r'^(?P<institution_id>[0-9]+)/nodes/$', views.InstitutionNodeList.as_view(), name='nodes'),
re_path(r'^(?P<institution_id>[0-9]+)/register/$', views.InstitutionalMetricsAdminRegister.as_view(), name='register_metrics_admin'),
]
12 changes: 6 additions & 6 deletions admin/internet_archive/urls.py
Original file line number Diff line number Diff line change
@@ -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'),
]
6 changes: 3 additions & 3 deletions admin/maintenance/urls.py
Original file line number Diff line number Diff line change
@@ -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'),
]
14 changes: 7 additions & 7 deletions admin/management/urls.py
Original file line number Diff line number Diff line change
@@ -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'),
]
8 changes: 4 additions & 4 deletions admin/meetings/urls.py
Original file line number Diff line number Diff line change
@@ -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<endpoint>[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<endpoint>[a-zA-Z0-9_]+)/$', views.MeetingFormView.as_view(),
name='detail'),
]
4 changes: 2 additions & 2 deletions admin/metrics/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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

app_name = 'admin'

urlpatterns = [
url(r'^$', login(views.MetricsView.as_view()), name='metrics'),
re_path(r'^$', login(views.MetricsView.as_view()), name='metrics'),
]
Loading

0 comments on commit cce3dd3

Please sign in to comment.