From: Yoan Le Clanche Date: Wed, 26 Jan 2022 13:42:42 +0000 (+0100) Subject: Lots of various fixes X-Git-Tag: 2.8.1-pro~120 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c3284a77f353e6291836df972f7159ea73ff2b1a;p=teleforma.git Lots of various fixes --- diff --git a/app/local_settings.py b/app/local_settings.py index 7ef9b870..b7b86de9 100644 --- a/app/local_settings.py +++ b/app/local_settings.py @@ -1,6 +1,4 @@ -DEBUG_TOOLBAR = True - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # EMAIL_HOST = 'smtp.pilotsystems.net' diff --git a/app/settings.py b/app/settings.py index d34b56de..4c55374b 100644 --- a/app/settings.py +++ b/app/settings.py @@ -17,10 +17,8 @@ TEMPLATE_DEBUG = DEBUG RECOVERY = True -# disable to debug websocket and improve performance DEBUG_TOOLBAR = False - BASE_DIR = os.path.dirname(os.path.dirname(__file__)) warnings.showwarning = lambda *x: None @@ -156,6 +154,7 @@ MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOL 'django_user_agents.middleware.UserAgentMiddleware', 'mezzanine.core.middleware.SitePermissionMiddleware' ) +print(MIDDLEWARE) ROOT_URLCONF = 'urls' @@ -247,7 +246,7 @@ POSTMAN_DISALLOW_ANONYMOUS = True TELEFORMA_ORGANIZATION = 'Pro-Barreau' TELEFORMA_SUBJECTS = ('Barreau', 'e-learning') TELEFORMA_DESCRIPTION = "E-learning Pro-Barreau" -TELEFORMA_E_LEARNING_TYPE = 'Pro-Barreau' +TELEFORMA_E_LEARNING_TYPE = 'AE' EMAIL_HOST = 'angus.parisson.com' DEFAULT_FROM_EMAIL = 'e-learning@pro-barreau.com' diff --git a/teleforma/admin.py b/teleforma/admin.py index 24328104..35563c08 100644 --- a/teleforma/admin.py +++ b/teleforma/admin.py @@ -306,6 +306,8 @@ class AnswerAdmin(admin.ModelAdmin): class SeminarRevisionAdmin(admin.ModelAdmin): search_fields = ['user__username', 'seminar__title'] date_hierarchy = 'date_modified' + readonly_fields=('date',) + actions = ['export_seminar_revisions'] diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index b48f76f5..4027046e 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index fd43c6aa..7cc7c467 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -1909,7 +1909,7 @@ msgstr "" #: templates/telemeta/login.html:29 msgid "Password forgotten" -msgstr "Mot de passe oublié ?" +msgstr "Mot de passe oublié" #: templates/telemeta/login.html:30 msgid "Sign in" @@ -3692,15 +3692,15 @@ msgstr "" msgid "" "Forgotten your password? Enter your e-mail address below, and we'll e-mail " "instructions for setting a new one." -msgstr "" +msgstr "Mot de passe perdu ? Saisissez votre adresse électronique ci-dessous et nous vous enverrons les instructions pour en créer un nouveau." #: templates/telemeta/registration/password_reset_form.html:11 msgid "E-mail address:" -msgstr "" +msgstr "Adresse électronique" #: templates/telemeta/registration/password_reset_form.html:11 msgid "Reset my password" -msgstr "" +msgstr "Réinitialiser mon mot de passe" #: templatetags/telemeta_utils.py:259 #, python-format diff --git a/teleforma/management/commands/teleforma-export-avis.py b/teleforma/management/commands/teleforma-export-avis.py index a4bb4813..abb9646f 100644 --- a/teleforma/management/commands/teleforma-export-avis.py +++ b/teleforma/management/commands/teleforma-export-avis.py @@ -17,17 +17,19 @@ from teleforma.views.pro import get_seminar_delta class Command(BaseCommand): help = "Send orders to avis-verifies ftp" - args = 'days' - option_list = BaseCommand.option_list + ( - make_option('--dry-run', action='store_true', - help='Do not send to ftp / mail'), - ) FTP_HOST = "global-ftp.netreviews.eu" FTP_PORT = 22 FTP_LOGIN = "fr_pro-barreau.com" FTP_PASSWORD = "pd8ExNC3" FTP_PATH = "/orders/" + def add_arguments(self, parser): + parser.add_argument('days', type=int) + parser.add_argument( + '--dry-run', + action='store_true', + help='Do not send to ftp / mail', + ) def log(self, message): print(message) @@ -36,7 +38,7 @@ class Command(BaseCommand): def handle(self, *args, **options): self.logs = "" - days = int(args[0]) + days = options['days'] dry_run = options['dry_run'] print(dry_run) logging.info('Generate csv file...') diff --git a/teleforma/migrations/0005_auto_20220117_1756.py b/teleforma/migrations/0005_auto_20220117_1756.py new file mode 100644 index 00000000..e540a15b --- /dev/null +++ b/teleforma/migrations/0005_auto_20220117_1756.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.3 on 2022-01-17 17:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('teleforma', '0004_forms_builder'), + ] + + operations = [ + migrations.AlterField( + model_name='auditor', + name='init_password', + field=models.BooleanField(default=False, verbose_name='Password initialized'), + ), + migrations.AlterField( + model_name='auditor', + name='platform_only', + field=models.BooleanField(default=False, verbose_name='platform only'), + ), + ] diff --git a/teleforma/models/core.py b/teleforma/models/core.py index 4783f116..82e396d5 100755 --- a/teleforma/models/core.py +++ b/teleforma/models/core.py @@ -773,7 +773,7 @@ class WebclassMixin(Model): def is_webclass_running(self): """ Is webclass currently running ? """ # print(self.get_webclass_info()) - return bbb.is_meeting_running(self.webclass_id).get_field('running').decode() == 'true' or False + return str(bbb.is_meeting_running(self.webclass_id).get_field('running')) == 'true' or False def get_webclass_info(self): """ """ @@ -791,12 +791,12 @@ class WebclassMixin(Model): for recording in recordings: url = recording.get('playback', {}).get('format', {}).get('url') if url: - url = url.decode() + url = str(url) data = { - 'start': int(recording['startTime'].decode()), - 'end': int(recording['endTime'].decode()), + 'start': int(str(recording['startTime'])), + 'end': int(str(recording['endTime'])), 'url': url, - 'state': recording['state'].decode(), + 'state': str(recording['state']), } data['duration'] = data['end'] - data['start'] all_records.append(data) diff --git a/teleforma/models/pro.py b/teleforma/models/pro.py index ad6a18bd..773aa525 100644 --- a/teleforma/models/pro.py +++ b/teleforma/models/pro.py @@ -372,7 +372,7 @@ class Auditor(models.Model): verbose_name=_('conferences'), blank=True) - platform_only = models.BooleanField(_('platform only')) + platform_only = models.BooleanField(_('platform only'), default=False) status = models.IntegerField(_('status'), choices=STATUS_CHOICES, default=2) gender = models.CharField(_('gender'), choices=GENDER_CHOICES, max_length=8, blank=True) company = models.CharField(_('Company'), max_length=255, blank=True) @@ -387,7 +387,7 @@ class Auditor(models.Model): block_fifpl = models.BooleanField(_('Block FIFPL'), default=False) block_testimonials = models.BooleanField(_('Block attestations'), default=False) expiration_date = models.DateField(_('Expiration_date'), blank=True, null=True) - init_password = models.BooleanField(_('Password initialized')) + init_password = models.BooleanField(_('Password initialized'), default=False) def __str__(self): try: diff --git a/teleforma/static/teleforma/css/teleforma.css b/teleforma/static/teleforma/css/teleforma.css index b5382ba1..7abbec88 100644 --- a/teleforma/static/teleforma/css/teleforma.css +++ b/teleforma/static/teleforma/css/teleforma.css @@ -2057,6 +2057,7 @@ form .exceed{ -webkit-border-radius: 8px 0px 8px 8px; border-radius: 8px 0px 8px 8px; width: 97%; + max-height: 30vh } diff --git a/teleforma/templates/admin/teleforma/seminarrevision/change_list.html b/teleforma/templates/admin/teleforma/seminarrevision/change_list.html deleted file mode 100644 index c5121c98..00000000 --- a/teleforma/templates/admin/teleforma/seminarrevision/change_list.html +++ /dev/null @@ -1,136 +0,0 @@ -{% extends "admin/base_site.html" %} -{% load i18n admin_static admin_list admin_urls suit_list suit_tags %} - -{% block extrastyle %} - {{ block.super }} - {# #} - {% if cl.formset %} - {# #} - {% endif %} - {% if cl.formset or action_form %} - {% url 'admin:jsi18n' as jsi18nurl %} - - {% endif %} - {{ media.css }} - {% if not actions_on_top and not actions_on_bottom %} - - {% endif %} -{% endblock %} - -{% block extrahead %} - {{ block.super }} - {{ media.js }} - {% if action_form %}{% if actions_on_top or actions_on_bottom %} - - {% endif %}{% endif %} -{% endblock %} - -{% block bodyclass %}change-list{% endblock %} - -{% if not is_popup %} - {% block breadcrumbs %} - - {% endblock %} -{% endif %} - -{% block coltype %}flex{% endblock %} - -{% block content %} - -
- -
-
- -
- {% block object-tools %} - {% if has_add_permission %} - - {% endif %} - {% endblock %} - - {% block search %}{% search_form cl %}{% endblock %} -
- - {% block date_hierarchy %} - {% if cl.date_hierarchy %} - {% date_hierarchy cl %} - {% endif %} - {% endblock %} - - {% if cl.formset.errors %} -
- {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} -
- {{ cl.formset.non_form_errors }} - {% endif %} - -
{% csrf_token %} - {% if cl.formset %} -
{{ cl.formset.management_form }}
- {% endif %} - - {% block result_list %} - {% if cl.result_count %} - {% if action_form and actions_on_top and cl.full_result_count %} - {% admin_actions %}{% endif %} - {% result_list_with_context cl %} - - {% if action_form and actions_on_bottom and cl.full_result_count %} - {% admin_actions %}{% endif %} - {% else %} - {% suit_bc_value 1.5 'pop' 1.6 '_popup' as POPUP_VAR %} -
- {% if cl.full_result_count %} -

{% trans 'Nothing found' %}!

-
- {% trans 'Reset search and filters' %} - {% else %} - {% blocktrans with cl.opts.verbose_name_plural|capfirst as name_plural %}{{ name_plural }} are not created yet{% endblocktrans %}. - {% if has_add_permission %} - {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}{% endif %} - {% endif %} -
- {% endif %} - {% endblock %} - - {% block pagination %} - {% if cl.result_count %} - {% if action_form and actions_on_bottom and cl.full_result_count %} -
- {% endif %} - {% pagination cl %} - {% if action_form and actions_on_bottom and cl.full_result_count %} -
- {% endif %} - {% endif %} - {% endblock %} -
-
-
-
-{% endblock %} diff --git a/teleforma/templates/registration/password_reset_email.html b/teleforma/templates/registration/password_reset_email.html index 5bf161f6..715e4fa9 100644 --- a/teleforma/templates/registration/password_reset_email.html +++ b/teleforma/templates/registration/password_reset_email.html @@ -5,7 +5,7 @@ {% trans "Please go to the following page and choose a new password:" %} {% block reset_link %} -{{ protocol }}://{{ domain }}{% url 'teleforma-password-reset-confirm' uidb36=uid token=token %} +{{ protocol }}://{{ domain }}{% url 'teleforma-password-reset-confirm' uidb64=uid token=token %} {% endblock %} {% trans "Your username, in case you've forgotten:" %} {{ user.username }} diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index 7d47c916..887a16d0 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -322,7 +322,7 @@ def fancy_duration_shop_like(duration): def fancy_seconds(seconds): time = '' hours = int(seconds / 3600) - minutes_int = (seconds % 3600) / 60 + minutes_int = int((seconds % 3600) / 60) if hours: if minutes_int: time += str(hours) + 'h' diff --git a/teleforma/urls.py b/teleforma/urls.py index 32eaed73..b0de2608 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -34,6 +34,7 @@ import os.path from django.conf.urls import url, include +from django.urls import path from jsonrpc import jsonrpc_site from django.contrib.auth.views import (LoginView, LogoutView, PasswordChangeDoneView, @@ -83,7 +84,7 @@ urlpatterns = [ email_template_name='registration/password_reset_email.html'), name="teleforma-password-reset"), url(r'^accounts/password_reset_done/$', PasswordResetDoneView.as_view( template_name='registration/password_reset_done.html'), name="password_reset_done"), - url(r'accounts/password_reset_confirm///', PasswordResetConfirmView.as_view( + path('accounts/password_reset_confirm///', PasswordResetConfirmView.as_view( template_name='registration/password_reset_confirm.html'), name="teleforma-password-reset-confirm"), url(r'^accounts/password_reset_complete/$', PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html'), name="password_reset_complete"), diff --git a/teleforma/views/ae.py b/teleforma/views/ae.py index e5dba088..6323e258 100644 --- a/teleforma/views/ae.py +++ b/teleforma/views/ae.py @@ -83,6 +83,6 @@ def get_ae_courses(user, date_order=False, num_order=False): if date_order: courses = sorted(courses, key=lambda k: k['date'], reverse=True) if num_order: - courses = sorted(courses, key=lambda k: k['number']) + courses = sorted(courses, key=lambda k: k['number'] or 0) return courses diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index 959d099b..077549f5 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -168,7 +168,7 @@ class SeminarRevisionMixin(object): all_revisions = SeminarRevision.objects.filter( user=user, date__gte=REVISION_DATE_FILTER, date_modified=None) now = datetime.datetime.now() - if seminar.expiry_date < now: + if not seminar.expiry_date or seminar.expiry_date < now: return if all_revisions: if not all_revisions[0].seminar == seminar: