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

Commit

Permalink
fix: fix ugettext() warning (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq authored Aug 28, 2023
1 parent 4f80c38 commit ee4361c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions registrar/apps/api/internal/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" API internal URLs. """

from django.conf.urls import url
from django.urls import re_path

from registrar.apps.core.constants import PROGRAM_KEY_PATTERN

Expand All @@ -10,12 +10,12 @@
app_name = 'internal'

urlpatterns = [
url(
re_path(
r'^cache/?$',
views.FlushProgramCacheView.as_view(),
name="flush-program-cache-all",
),
url(
re_path(
fr'^cache/{PROGRAM_KEY_PATTERN}/?$',
views.FlushProgramCacheView.as_view(),
name="flush-program-cache-one",
Expand Down
10 changes: 5 additions & 5 deletions registrar/apps/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
All API URLs should be versioned, so urlpatterns should only
contain namespaces for the active versions of the API.
"""
from django.conf.urls import include, url
from django.urls import include, path

from .internal import urls as internal_urls
from .v1 import urls as v1_urls
Expand All @@ -14,8 +14,8 @@

app_name = 'api'
urlpatterns = [
url(r'^internal/', include(internal_urls)),
url(r'^v1/', include(v1_urls)),
url(r'^v2/', include(v2_urls)),
url(r'^v3/', include(v3_urls)),
path('internal/', include(internal_urls)),
path('v1/', include(v1_urls)),
path('v2/', include(v2_urls)),
path('v3/', include(v3_urls)),
]
28 changes: 14 additions & 14 deletions registrar/apps/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
from django.urls import re_path

from registrar.apps.core.constants import (
COURSE_ID_PATTERN,
Expand All @@ -14,66 +14,66 @@
app_name = 'v1'

urlpatterns = [
url(
re_path(
r'^programs/?$',
views.ProgramListView.as_view(),
name="program-list",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/?$',
views.ProgramRetrieveView.as_view(),
name="program",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/enrollments/?$',
views.ProgramEnrollmentView.as_view(),
name="program-enrollments",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/courses/?$',
views.ProgramCourseListView.as_view(),
name="program-course-list",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/enrollments/?$',
views.ProgramEnrollmentView.as_view(),
name="program-enrollment",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/courses/{COURSE_ID_PATTERN}/grades/?$',
views.CourseGradesView.as_view(),
name="program-course-grades",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/courses/{COURSE_ID_PATTERN}/enrollments/?$',
views.CourseEnrollmentView.as_view(),
name="program-course-enrollment",
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/enrollments/upload/?$',
views.ProgramEnrollmentUploadView.as_view(),
name="program-enrollment-upload"
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/course_enrollments/upload/?$',
views.CourseRunEnrollmentUploadView.as_view(),
name="program-course-enrollment-upload"
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/course_enrollments/?$',
views.CourseRunEnrollmentDownloadView.as_view(),
name="program-course-enrollment-download"
),
url(
re_path(
fr'^programs/{PROGRAM_KEY_PATTERN}/reports',
views.ReportsListView.as_view(),
),
url(
re_path(
r'^jobs/?$',
views.JobStatusListView.as_view(),
name="job-status-list",
),
url(
re_path(
fr'^jobs/{JOB_ID_PATTERN}/?$',
views.JobStatusRetrieveView.as_view(),
name="job-status",
Expand Down
4 changes: 2 additions & 2 deletions registrar/apps/api/v3/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
""" API v3 URLs. """

from django.conf.urls import url
from django.urls import re_path

from . import views


app_name = 'v3'

urlpatterns = [
url(
re_path(
r'^programs/?$',
views.ProgramListPaginationView.as_view(),
name="program-list",
Expand Down
2 changes: 1 addition & 1 deletion registrar/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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 guardian.admin import GuardedModelAdmin

from .models import (
Expand Down
2 changes: 1 addition & 1 deletion registrar/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.contrib.auth.models import AbstractUser, Group
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from guardian.shortcuts import remove_perm
from model_utils.models import TimeStampedModel

Expand Down
28 changes: 14 additions & 14 deletions registrar/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

from auth_backends.urls import oauth2_urlpatterns
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path, re_path
from django.views.generic.base import RedirectView
from edx_api_doc_tools import make_api_info, make_docs_ui_view

Expand All @@ -46,40 +46,40 @@
email="[email protected]",
description=api_description_file.read(),
),
api_url_patterns=[url(r'^api/v2/', include(v2_urls))],
api_url_patterns=[path('api/v2/', include(v2_urls))],
)

urlpatterns = oauth2_urlpatterns + [
# '/' and '/login' redirect to '/login/',
# which attempts LMS OAuth and then redirects to api-docs.
url(r'^/?$', RedirectView.as_view(url=settings.LOGIN_URL)),
url(r'^login$', RedirectView.as_view(url=settings.LOGIN_URL)),
re_path(r'^/?$', RedirectView.as_view(url=settings.LOGIN_URL)),
path('login', RedirectView.as_view(url=settings.LOGIN_URL)),

# Use the same auth views for all logins,
# including those originating from the browseable API.
url(r'^api-auth/', include(oauth2_urlpatterns)),
path('api-auth/', include(oauth2_urlpatterns)),

# NEW Swagger documentation UI, generated using edx-api-doc-tools.
url(r'^api-docs$', RedirectView.as_view(pattern_name='api-docs-new')),
url(r'^api-docs/$', new_api_ui_view, name='api-docs-new'),
path('api-docs', RedirectView.as_view(pattern_name='api-docs-new')),
path('api-docs/', new_api_ui_view, name='api-docs-new'),

# Django admin panel.
url(r'^admin$', RedirectView.as_view(pattern_name='admin:index')),
url(r'^admin/', admin.site.urls),
path('admin', RedirectView.as_view(pattern_name='admin:index')),
re_path(r'^admin/', admin.site.urls),

# Health view.
url(r'^health/?$', core_views.health, name='health'),
re_path(r'^health/?$', core_views.health, name='health'),

# Auto-auth for testing. View raises 404 if not `settings.ENABLE_AUTO_AUTH`
url(r'^auto_auth/?$', core_views.AutoAuth.as_view(), name='auto_auth'),
re_path(r'^auto_auth/?$', core_views.AutoAuth.as_view(), name='auto_auth'),

# The API itself!
url(r'^api/', include(api_urls)),
path('api/', include(api_urls)),
]

# edx-drf-extensions csrf app
urlpatterns += [
url(r'', include('csrf.urls')),
path('', include('csrf.urls')),
]

if settings.DEBUG and os.environ.get('ENABLE_DJANGO_TOOLBAR', False): # pragma: no cover
Expand All @@ -90,7 +90,7 @@
"ENABLE_DJANGO_TOOLBAR is true, but debug_toolbar could not be imported."
)
else:
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))
urlpatterns.append(path('__debug__/', include(debug_toolbar.urls)))

if settings.DEBUG: # pragma: no cover
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 comments on commit ee4361c

Please sign in to comment.