Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added support for Django 4.2 #443

Merged
merged 3 commits into from
Jul 31, 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
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
Loading