-
Notifications
You must be signed in to change notification settings - Fork 77
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
[Done] Add any video in user channel #864
[Done] Add any video in user channel #864
Conversation
Bonjour, n'hésitez pas à revenir vers nous sur le canal team pour nous signaler vos PR. Quel est le but de cette modification ? merci |
Bonjour, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merci pour cette PR.
Pouvez-vous également ajouter un test unitaire qui vérifie la partie ajoutée ?
pod/video/forms.py
Outdated
@@ -633,9 +633,28 @@ def clean_date_delete(self): | |||
) | |||
return self.cleaned_data["date_delete"] | |||
|
|||
def clean(self): | |||
def clean(self): # noqa: C901 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si vous pouvez ajouter une petite pydoc sous ce format : """Description de la fonction."""
ce serait top ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est fait :)
pod/video/forms.py
Outdated
cleaned_data = super(VideoForm, self).clean() | ||
|
||
users_groups = self.current_user.owner.accessgroup_set.all() | ||
|
||
if "channel" in cleaned_data.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ajouter un petit commentaire qui rappelle ce que cette partie fait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AymericJak et moi avons testé en local. Lorsque nous tentons d'ajouter une vidéo dans une chaîne dont nous sommes propriétaire depuis l'édition d'une vidéo, nous avons ce soucis :
Environment:
Request Method: POST
Request URL: http://localhost:9090/video/edit/0002-le-coucher-du-soleil-111204mp4/
Django Version: 3.2.19
Python Version: 3.7.16
Installed Applications:
['modeltranslation',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'ckeditor',
'sorl.thumbnail',
'tagging',
'cas',
'captcha',
'rest_framework',
'rest_framework.authtoken',
'django_filters',
'django_select2',
'shibboleth',
'chunked_upload',
'mozilla_django_oidc',
'honeypot',
'lti_provider',
'pod.main',
'django.contrib.admin',
'pod.authentication',
'pod.video',
'pod.podfile',
'pod.playlist',
'pod.completion',
'pod.chapter',
'pod.enrichment',
'pod.video_search',
'pod.live',
'pod.recorder',
'pod.lti',
'pod.bbb',
'pod.meeting',
'pod.cut',
'pod.xapi',
'pod.favorite',
'pod.custom']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware']
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.7/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/usr/src/app/pod/video/views.py", line 1000, in video_edit
video = save_video_form(request, form)
File "/usr/src/app/pod/video/views.py", line 1029, in save_video_form
form.save_m2m()
File "/usr/local/lib/python3.7/site-packages/django/forms/models.py", line 451, in _save_m2m
f.save_form_data(self.instance, cleaned_data[f.name])
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/related.py", line 1668, in save_form_data
getattr(instance, self.attname).set(data)
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 992, in set
objs = tuple(objs)
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 280, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1162, in execute_sql
sql, params = self.as_sql()
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 522, in as_sql
result, params = self.get_combinator_sql(combinator, self.query.combinator_all)
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 459, in get_combinator_sql
raise DatabaseError('ORDER BY not allowed in subqueries of compound statements.')
Exception Type: DatabaseError at /video/edit/0002-le-coucher-du-soleil-111204mp4/
Exception Value: ORDER BY not allowed in subqueries of compound statements.
pod/video/forms.py
Outdated
| Channel.objects.filter(allow_to_groups__in=users_groups) | ||
).distinct() | ||
|
||
user_channels.filter(site=get_current_site(None)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi avoir mis None
dans get_current_site(None)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cette ligne avait été utilisée dans une autre partie de l'application, je l'ai utilisé telle quelle. Je ne vois quel argument autre passer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vous pourriez tester de nouveau ?
8afb94e
to
ea8873f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pas testé fonctionnellement mais coté code ca me convient. Je regarde rapidement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testé, ca fonctionne de mon coté. Merci pour cette contribution
* issue 795 - ajout n'importe quelle video à une chaine * method clean_channel * change line ending --------- Co-authored-by: mattbild <[email protected]>
#795
pour un utilisateur avec les droits d'édition des vidéos, possibilité d'associer une vidéo à toute chaine dont il est propriétaire. L'association existante de la vidéo avec des chaines d'autres utilisateurs n'est plus supprimée
utilisation de la méthode clean_channel pour le merge des channels de l'utilisateur