Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

fix: codemod for django42 applied #278

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Unreleased

*

[1.4.0] - 2023-08-07
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Added
_______

* Added support for Django 4.2


[1.3.1] - 2023-03-06
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion blockstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Blockstore is a system for storing educational content.
"""

__version__ = '1.3.1'
__version__ = '1.4.0'
6 changes: 2 additions & 4 deletions blockstore/apps/bundles/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def get_max_num(self, request, obj=None, **kwargs):
return max(obj.drafts.count(), 3)


@admin.register(Bundle)
class BundleAdmin(admin.ModelAdmin):
"""
View for creating or updating Bundles and their BundleVersions & Drafts.
Expand All @@ -90,9 +91,6 @@ def get_readonly_fields(self, request, obj=None):
return ('uuid',)


@admin.register(Collection)
class CollectionAdmin(admin.ModelAdmin):
list_display = ('title', 'uuid')


admin.site.register(Bundle, BundleAdmin)
admin.site.register(Collection, CollectionAdmin)
2 changes: 1 addition & 1 deletion blockstore/apps/bundles/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from .storage import default_asset_storage

logger = logging.getLogger(__name__)
snapshot_created = Signal(providing_args=["bundle_uuid", "hash_digest"])
snapshot_created = Signal()


@attr.s(frozen=True)
Expand Down
4 changes: 2 additions & 2 deletions blockstore/apps/bundles/tests/storage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import re

from django.conf import settings
from django.conf.urls import url
from django.urls import re_path
from django.views.static import serve
from django.test import override_settings

Expand Down Expand Up @@ -122,7 +122,7 @@ def url_for_test_media():
horrible performance characteristics.
"""
media_url = re.escape(settings.MEDIA_URL.lstrip('/'))
return url(
return re_path(
fr'^{media_url}(?P<path>.*)$',
serve_media,
)
6 changes: 2 additions & 4 deletions blockstore/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from blockstore.apps.core.models import User


@admin.register(User)
class CustomUserAdmin(UserAdmin):
""" Admin configuration for the custom User model. """
list_display = ('username', 'email', 'full_name', 'first_name', 'last_name', 'is_staff')
Expand All @@ -17,6 +18,3 @@ class CustomUserAdmin(UserAdmin):
'groups', 'user_permissions')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)


admin.site.register(User, CustomUserAdmin)
2 changes: 1 addition & 1 deletion blockstore/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class User(AbstractUser):
Expand Down
4 changes: 2 additions & 2 deletions blockstore/apps/rest_api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
All API URLs should be versioned, so urlpatterns should only
contain namespaces for the active versions of the API.
"""
from django.conf.urls import url, include
from django.urls import include, path

app_name = 'blockstore'

urlpatterns = [
url(r'^v1/', include('blockstore.apps.rest_api.v1.urls', namespace='v1')),
path('v1/', include('blockstore.apps.rest_api.v1.urls', namespace='v1')),
]
4 changes: 2 additions & 2 deletions blockstore/apps/rest_api/v1/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" API v1 URLs. """

from django.conf.urls import url, include
from django.urls import include, path

from ..routers import DefaultRouter
from .views.bundles import BundleViewSet, BundleVersionViewSet
Expand All @@ -17,5 +17,5 @@
root_router.register(r'drafts', DraftViewSet)

urlpatterns = [
url(r'^', include(root_router.urls)),
path('', include(root_router.urls)),
]
14 changes: 7 additions & 7 deletions blockstore/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from auth_backends.urls import oauth2_urlpatterns
from django.conf import settings
from django.conf.urls import include, url
from django.urls import include, path, re_path
from django.conf.urls.static import static
from django.contrib import admin

Expand All @@ -35,19 +35,19 @@


urlpatterns = oauth2_urlpatterns + [
url(r'^admin/', admin.site.urls),
url(r'^api/', include('blockstore.apps.rest_api.urls', namespace='api')),
re_path(r'^admin/', admin.site.urls),
path('api/', include('blockstore.apps.rest_api.urls', namespace='api')),
# Use the same auth views for all logins, including those originating from the browseable API.
url(r'^api-auth/', include((oauth2_urlpatterns, 'auth_backends'), namespace='rest_framework')),
url(r'^auto_auth/$', core_views.AutoAuth.as_view(), name='auto_auth'),
url(r'^health/$', core_views.health, name='health'),
path('api-auth/', include((oauth2_urlpatterns, 'auth_backends'), namespace='rest_framework')),
path('auto_auth/', core_views.AutoAuth.as_view(), name='auto_auth'),
path('health/', core_views.health, name='health'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += make_docs_urls(api_info)

if settings.DEBUG: # pragma: no cover
import debug_toolbar # pylint: disable=import-error,useless-suppression
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))
urlpatterns.append(path('__debug__/', include(debug_toolbar.urls)))

if settings.DEBUG or os.environ['DJANGO_SETTINGS_MODULE'] == 'blockstore.settings.test':
urlpatterns.append(url_for_test_media())
Loading