Skip to content

Commit

Permalink
Merge pull request #443 from openedx/zshkoor/django42
Browse files Browse the repository at this point in the history
fix: Added support for Django 4.2
  • Loading branch information
zubairshakoorarbisoft authored Jul 31, 2023
2 parents edf2e37 + 4cb1493 commit 9dd7896
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [django32, quality]
toxenv: [django32, django42, quality]

steps:
- uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
run: tox

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv=='django32'
if: matrix.python-version == '3.8' && matrix.toxenv=='django42'
uses: codecov/codecov-action@v2
with:
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion edxval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
init
"""

__version__ = '2.3.0'
__version__ = '2.4.0'
41 changes: 19 additions & 22 deletions edxval/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)


@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):
""" Admin for profile """
list_display = ('id', 'profile_name')
Expand All @@ -37,6 +38,7 @@ class CourseVideoInline(admin.TabularInline):
verbose_name_plural = "Courses"


@admin.register(Video)
class VideoAdmin(admin.ModelAdmin):
""" Admin for Video """
list_display = (
Expand All @@ -49,83 +51,78 @@ class VideoAdmin(admin.ModelAdmin):
inlines = [CourseVideoInline, EncodedVideoInline]


@admin.register(VideoImage)
class VideoImageAdmin(admin.ModelAdmin):
""" Admin for VideoImage """
raw_id_fields = ('course_video', )
list_display = ('get_course_video', 'image', 'generated_images')
search_fields = ('id', 'course_video__course_id', 'course_video__video__edx_video_id', 'generated_images')

@admin.display(
description='Course Video',
ordering='course_video',
)
def get_course_video(self, obj):
""" get course video """
return '"{course_id}" -- "{edx_video_id}" '.format(
course_id=obj.course_video.course_id,
edx_video_id=obj.course_video.video.edx_video_id
)

get_course_video.admin_order_field = 'course_video'
get_course_video.short_description = 'Course Video'

model = VideoImage

verbose_name = 'Video Image'
verbose_name_plural = 'Video Images'


@admin.register(CourseVideo)
class CourseVideoAdmin(admin.ModelAdmin):
""" Admin for CourseVideo """
list_display = ('course_id', 'get_video_id', 'is_hidden')
search_fields = ('id', 'course_id', 'video__status', 'video__edx_video_id')

@admin.display(
description='edX Video Id',
ordering='video',
)
def get_video_id(self, obj):
""" get video id """
return obj.video.edx_video_id

get_video_id.admin_order_field = 'video'
get_video_id.short_description = 'edX Video Id'

model = CourseVideo
verbose_name = 'Course Video'
verbose_name_plural = 'Course Videos'


@admin.register(VideoTranscript)
class VideoTranscriptAdmin(admin.ModelAdmin):
""" Admin for VideoTranscript """
raw_id_fields = ('video',)
list_display = ('get_video', 'language_code', 'provider', 'file_format')
search_fields = ('id', 'video__edx_video_id', 'language_code')

@admin.display(
description='Video',
ordering='video',
)
def get_video(self, transcript):
""" get video """
return transcript.video.edx_video_id if getattr(transcript, 'video', False) else ''

get_video.admin_order_field = 'video'
get_video.short_description = 'Video'

model = VideoTranscript
verbose_name = 'Video Transcript'
verbose_name_plural = 'Video Transcripts'


@admin.register(TranscriptPreference)
class TranscriptPreferenceAdmin(admin.ModelAdmin):
""" Admin for TranscriptPreference """
list_display = ('course_id', 'provider', 'video_source_language', 'preferred_languages')

model = TranscriptPreference


@admin.register(ThirdPartyTranscriptCredentialsState)
class ThirdPartyTranscriptCredentialsStateAdmin(admin.ModelAdmin):
""" Admin for ThirdPartyTranscriptCredentialsState """
list_display = ('org', 'provider', 'has_creds', 'created', 'modified')

model = ThirdPartyTranscriptCredentialsState
verbose_name = 'Organization Transcript Credential State'
verbose_name_plural = 'Organization Transcript Credentials State'


admin.site.register(Profile, ProfileAdmin)
admin.site.register(Video, VideoAdmin)
admin.site.register(VideoTranscript, VideoTranscriptAdmin)
admin.site.register(TranscriptPreference, TranscriptPreferenceAdmin)
admin.site.register(VideoImage, VideoImageAdmin)
admin.site.register(CourseVideo, CourseVideoAdmin)
admin.site.register(ThirdPartyTranscriptCredentialsState, ThirdPartyTranscriptCredentialsStateAdmin)
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tox]
envlist = py38-django{32}, quality
envlist = py38-django{32,42}, quality

[testenv]
deps =
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django42: Django>=4.2,<4.3
-r{toxinidir}/requirements/test.txt
commands =
python -Wd -m pytest {posargs}
Expand Down

0 comments on commit 9dd7896

Please sign in to comment.