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

Pod v4 MAIN #1229

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
73ed68a
* UPGRADE Django to v4.2.16
Badatos Oct 24, 2024
e50187e
Merge branch 'develop' into pod_V4
Badatos Oct 28, 2024
7e4cd06
* Remove USE_L10N deprecated param
Badatos Oct 28, 2024
af15471
Remove `USE_L10N` from test_settings
Badatos Oct 28, 2024
7c01d4b
Merge branch 'develop' into pod_V4
Badatos Oct 29, 2024
a721a03
* Correct video_edit slect2 display with tagulous (remove duplicated …
Badatos Oct 29, 2024
4deb722
* Remove Python 3.8 from compatible py versions, and add 3.12
Badatos Oct 30, 2024
b2975a6
Merge branch 'develop' into pod_V4
Badatos Oct 30, 2024
645b930
Upgrade dependencies
Badatos Oct 30, 2024
7c5d362
several corrections for 4.0. Prepare to say goodbye to CKEditor
Badatos Nov 13, 2024
917a006
correct video/models.py
Badatos Nov 13, 2024
9a4ab7f
Remove Compatibility with ES 6
Badatos Nov 21, 2024
097edab
Replace js_asset by django.templatetags.static, as js_asset is deprec…
Badatos Nov 21, 2024
151af7c
Fix code scanning alert no. 81: URL redirection from remote source
Badatos Nov 21, 2024
ccfebc3
Improve security in pod playlists, as suggested by CodeQL
Badatos Nov 21, 2024
5941015
Disable some video_tags functions
Badatos Nov 21, 2024
bf7dc21
Flake8 compliance
Badatos Nov 21, 2024
cb32056
Disable Debug in test_settings
Badatos Nov 21, 2024
c9de8e1
only add debug toolbar when not in testing mode
Badatos Nov 21, 2024
d28b3dc
Add title_en to sample videos.json
Badatos Nov 21, 2024
6bd0164
Reset ES-INDEX for tests as "Pod"
Badatos Nov 21, 2024
3c17c09
Use Elasticsearch 7 in github workflows
Badatos Nov 21, 2024
b54952b
set Video tags as "not required" + correct bug on video tags indexing
Badatos Nov 21, 2024
fd9fbaa
Adapt Video views and video-info to Tagulous
Badatos Nov 25, 2024
bf5cabd
adapt video get_json_to_index() function to Tagulous
Badatos Nov 25, 2024
92ac5b2
Adapt Video Recorder to Tagulous
Badatos Nov 25, 2024
cecec76
Only do dressing tests when `USE_DRESSING==True
Badatos Nov 25, 2024
f7d1a21
* Only run `cut` tests when `USE_CUT==True`
Badatos Nov 25, 2024
44a9a5b
Merge branch 'develop' into pod_V4
Badatos Nov 28, 2024
dfd0662
+ Upgrade all py packages
Badatos Dec 2, 2024
14c3457
Drop compatibility with ES 7
Badatos Dec 2, 2024
ff15569
Upgrade importlib-metadata to 7.2.1 for compatibility with ralph-malp…
Badatos Dec 2, 2024
e6ed3f7
replace "order" by "date_added" in channel video sorting
Badatos Dec 3, 2024
abd6cdc
Display a tag cloud with tags assigned to videos
Badatos Dec 3, 2024
4698507
apply GH actions "pod_dev" and "code_formatting" on pod_V4 branch
Badatos Dec 3, 2024
2501b45
Fixup. Format code with Prettier
invalid-email-address Dec 3, 2024
a18ea13
Fixup. Format code with Black
invalid-email-address Dec 3, 2024
76e6191
Auto-update configuration files
invalid-email-address Dec 3, 2024
7b58f99
Merge branch 'main' into pod_V4
Badatos Dec 4, 2024
c2d1011
Bump ELASTICSEARCH_TAG to 8.16.1
Badatos Dec 4, 2024
b5fc92a
Change elastic-github-actions to master to avoid ES 8 issue
Badatos Dec 4, 2024
92fa056
Set ES_VERSION=8 in settings_local_docker
Badatos Dec 5, 2024
4853cdd
Fixup. Format code with Black
invalid-email-address Dec 5, 2024
12d0c3f
test ES with CURL after create_pod_index
Badatos Dec 5, 2024
e62575b
Merge branch 'pod_V4' of https://github.com/EsupPortail/Esup-Pod into…
Badatos Dec 5, 2024
68d7f5f
test with es1:9200 url
Badatos Dec 5, 2024
3216702
Return to elasticsearch.localhost url
Badatos Dec 5, 2024
6eeedd4
add --insecure to curl command
Badatos Dec 5, 2024
8cfc848
Disable elastic-github-actions security
Badatos Dec 9, 2024
50c5437
replace https by http in curl
Badatos Dec 9, 2024
7343fa0
increase sqlite timeout in test settings to have less "sqlite3.Operat…
Badatos Dec 9, 2024
5115cb4
Replace `assertNotEquals`by `assertNotEqual`for Python 3.12 compatibi…
Badatos Dec 9, 2024
2f928f9
Replace remaining assertEquals by assertEqual
Badatos Dec 9, 2024
ec9addf
Bump Django to 4.2.17 (fix 2 CVE, see https://docs.djangoproject.com/…
Badatos Dec 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/pod_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
max-parallel: 2
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10', '3.12']
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ pod/static/
.cache_ggshield
htmlcov
compile-model
pod/activitypub/*.pub

# IDE Files #
#############
.idea
.vscode
*.code-workspace

# Certificates #
################
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ help:
# Démarre le serveur de test
start:
(sleep 15 ; open http://pod.localhost:8000) &
python3 manage.py runserver pod.localhost:8000 --insecure
python3 -Wd manage.py runserver pod.localhost:8000 --insecure
# --insecure let serve static files even when DEBUG=False

# Démarre le serveur de test en https auto-signé
starts:
# nécessite les django-extensions
# cf https://timonweb.com/django/https-django-development-server-ssl-certificate/
(sleep 15 ; open https://pod.localhost:8000) &
python3 manage.py runserver_plus pod.localhost:8000 --cert-file cert.pem --key-file key.pem
python3 -Wd manage.py runserver_plus pod.localhost:8000 --cert-file cert.pem --key-file key.pem

# Première installation de pod (BDD SQLite intégrée)
install:
Expand All @@ -44,7 +44,7 @@ createDB:
find . -path "*/migrations/*.pyc" -delete
make updatedb
make migrate
python3 manage.py loaddata initial_data
python3 -Wd manage.py loaddata initial_data

# Mise à jour des fichiers de langue
lang:
Expand Down Expand Up @@ -82,8 +82,8 @@ statics:

# Generate configuration docs in .MD format
createconfigs:
python3 manage.py createconfiguration fr
python3 manage.py createconfiguration en
python3 -Wd manage.py createconfiguration fr
python3 -Wd manage.py createconfiguration en

# -- Docker
# Use for docker run and docker exec commands
Expand Down
4 changes: 2 additions & 2 deletions pod/ai_enhancement/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from tagging.fields import TagField
from django.utils.translation import gettext_lazy as _
from tagulous.models import TagField

from pod.main.forms_utils import add_placeholder_and_asterisk
from pod.video.models import Video, Discipline
Expand Down
2 changes: 1 addition & 1 deletion pod/ai_enhancement/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.dispatch import receiver
from django.db.models.signals import post_save
from pod.video.models import Video
Expand Down
4 changes: 2 additions & 2 deletions pod/ai_enhancement/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.conf import settings
from requests import Response
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from pod.ai_enhancement.models import AIEnhancement
from pod.main.utils import extract_json_from_str
from pod.video.models import Discipline, Video
Expand All @@ -27,7 +27,7 @@

AI_ENHANCEMENT_API_URL = getattr(settings, "AI_ENHANCEMENT_API_URL", "")
AI_ENHANCEMENT_API_VERSION = getattr(settings, "AI_ENHANCEMENT_API_VERSION", "")
USE_NOTIFICATIONS = getattr(settings, "USE_NOTIFICATIONS", True)
USE_NOTIFICATIONS = getattr(settings, "USE_NOTIFICATIONS", False)
EMAIL_ON_ENHANCEMENT_COMPLETION = getattr(
settings, "EMAIL_ON_ENHANCEMENT_COMPLETION", True
)
Expand Down
2 changes: 1 addition & 1 deletion pod/ai_enhancement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.views.decorators.csrf import ensure_csrf_cookie
from django.core.exceptions import PermissionDenied
Expand Down
1 change: 0 additions & 1 deletion pod/authentication/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "pod.authentication.apps.AuthConfig"
12 changes: 5 additions & 7 deletions pod/authentication/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 as BaseUserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils.html import format_html
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.auth.models import Group
Expand Down Expand Up @@ -84,12 +84,11 @@ class Media:


class UserAdmin(BaseUserAdmin):
@admin.display(description=_("Email"))
def clickable_email(self, obj):
email = obj.email
return format_html('<a href="mailto:{}">{}</a>', email, email)

clickable_email.allow_tags = True
clickable_email.short_description = _("Email")
list_display = (
"username",
"last_name",
Expand Down Expand Up @@ -130,11 +129,10 @@ def formfield_for_manytomany(self, db_field, request, **kwargs):
kwargs["widget"] = widgets.FilteredSelectMultiple(db_field.verbose_name, False)
return super().formfield_for_foreignkey(db_field, request, **kwargs)

@admin.display(description=_("Establishment"))
def owner_establishment(self, obj) -> str:
return "%s" % Owner.objects.get(user=obj).establishment

owner_establishment.short_description = _("Establishment")

ordering = (
"-is_superuser",
"username",
Expand Down Expand Up @@ -188,6 +186,7 @@ def get_inline_instances(self, request, obj=None):
return _inlines


@admin.register(AccessGroup)
class AccessGroupAdmin(admin.ModelAdmin):
# form = AccessGroupAdminForm
# search_fields = ["user__username__icontains", "user__email__icontains"]
Expand All @@ -200,6 +199,7 @@ class AccessGroupAdmin(admin.ModelAdmin):
)


@admin.register(Owner)
class OwnerAdmin(admin.ModelAdmin):
# form = AdminOwnerForm
autocomplete_fields = ["user", "accessgroups"]
Expand All @@ -225,5 +225,3 @@ class Meta:
# Register the new Group ModelAdmin instead of the original one.
admin.site.unregister(Group)
admin.site.register(Group, GroupAdmin)
admin.site.register(Owner, OwnerAdmin)
admin.site.register(AccessGroup, AccessGroupAdmin)
2 changes: 1 addition & 1 deletion pod/authentication/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.contrib.auth import get_user_model
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.contrib.sites.models import Site

__FILEPICKER__ = False
Expand Down
2 changes: 1 addition & 1 deletion pod/authentication/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Esup-Pod authentication models."""

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User, Permission, Group
from django.conf import settings
from django.dispatch import receiver
Expand Down
2 changes: 1 addition & 1 deletion pod/authentication/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.test import Client
from django.contrib.auth.models import User
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class authenticationViewsTestCase(TestCase):
Expand Down
18 changes: 9 additions & 9 deletions pod/authentication/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
from .views import authentication_logout
from .views import authentication_login_gateway

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

app_name = "authentication"

urlpatterns = [
# auth cas
url(
r"^login/$",
path(
"login/",
authentication_login,
name="authentication_login",
),
url(
r"^logout/$",
path(
"logout/",
authentication_logout,
name="authentication_logout",
),
# url(r"^login/$", authentication_login, name="login"),
# url(r"^logout/$", authentication_logout, name="logout"),
url(
r"^login_gateway/$",
# re_path(r"^login/$", authentication_login, name="login"),
# re_path(r"^logout/$", authentication_logout, name="logout"),
path(
"login_gateway/",
authentication_login_gateway,
name="authentication_login_gateway",
),
Expand Down
2 changes: 1 addition & 1 deletion pod/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.urls import reverse
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from cas.decorators import gateway
from django.contrib import auth

Expand Down
4 changes: 1 addition & 3 deletions pod/chapter/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pod.video.models import Video


@admin.register(Chapter)
class ChapterAdmin(admin.ModelAdmin):
"""Chapter administration."""

Expand All @@ -33,9 +34,6 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs):
return super().formfield_for_foreignkey(db_field, request, **kwargs)


admin.site.register(Chapter, ChapterAdmin)


class ChapterInline(admin.TabularInline):
model = Chapter
extra = 0
2 changes: 1 addition & 1 deletion pod/chapter/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from pod.chapter.models import Chapter
from pod.chapter.utils import vtt_to_chapter
Expand Down
2 changes: 1 addition & 1 deletion pod/chapter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.core.exceptions import ValidationError
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from pod.video.models import Video
from pod.video.utils import verify_field_length
Expand Down
4 changes: 2 additions & 2 deletions pod/chapter/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.conf.urls import url
from django.urls import re_path
from pod.chapter.views import video_chapter

app_name = "chapter"

urlpatterns = [
url(
re_path(
r"^(?P<slug>[\-\d\w]+)/$",
video_chapter,
name="video_chapter",
Expand Down
2 changes: 1 addition & 1 deletion pod/chapter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.template.loader import render_to_string
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_protect
from pod.video.models import Video
from pod.chapter.models import Chapter
Expand Down
22 changes: 6 additions & 16 deletions pod/completion/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from pod.completion.models import Contributor
from pod.completion.models import Document
from pod.completion.models import Overlay
Expand Down Expand Up @@ -45,6 +45,7 @@ def has_add_permission(self, request, obj=None):
return False


@admin.register(Contributor)
class ContributorAdmin(admin.ModelAdmin):
list_display = (
"name",
Expand All @@ -71,9 +72,6 @@ def get_queryset(self, request):
return qs


admin.site.register(Contributor, ContributorAdmin)


class DocumentInline(admin.TabularInline):
model = Document
readonly_fields = (
Expand All @@ -86,6 +84,7 @@ def has_add_permission(self, request, obj=None):
return False


@admin.register(Document)
class DocumentAdmin(admin.ModelAdmin):
if __FILEPICKER__:
form = DocumentAdminForm
Expand Down Expand Up @@ -124,9 +123,6 @@ class Media:
)


admin.site.register(Document, DocumentAdmin)


class TrackInline(admin.TabularInline):
model = Track
readonly_fields = (
Expand All @@ -142,6 +138,7 @@ def has_add_permission(self, request, obj=None):
return False


@admin.register(EnrichModelQueue)
class EnrichModelQueueAdmin(admin.ModelAdmin):
list_display = (
"title",
Expand All @@ -150,9 +147,7 @@ class EnrichModelQueueAdmin(admin.ModelAdmin):
list_filter = ("in_treatment",)


admin.site.register(EnrichModelQueue, EnrichModelQueueAdmin)


@admin.register(Track)
class TrackAdmin(admin.ModelAdmin):
def debug(text) -> None:
if DEBUG:
Expand Down Expand Up @@ -311,9 +306,6 @@ class Media:
)


admin.site.register(Track, TrackAdmin)


class OverlayInline(admin.TabularInline):
model = Overlay
readonly_fields = (
Expand All @@ -332,6 +324,7 @@ def has_add_permission(self, request, obj=None):
return False


@admin.register(Overlay)
class OverlayAdmin(admin.ModelAdmin):
list_display = (
"title",
Expand All @@ -354,6 +347,3 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs):

# class Media:
# css = {"all": ("css/pod.css",)}


admin.site.register(Overlay, OverlayAdmin)
2 changes: 0 additions & 2 deletions pod/completion/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from django.conf import settings
from django.forms.widgets import HiddenInput

# from django.utils.translation import ugettext_lazy as _

from pod.completion.models import Contributor
from pod.completion.models import Document
from pod.completion.models import Track
Expand Down
Loading
Loading