]> git.parisson.com Git - teleforma.git/commitdiff
Lots of various fixes
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 26 Jan 2022 13:42:42 +0000 (14:42 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 26 Jan 2022 13:42:42 +0000 (14:42 +0100)
16 files changed:
app/local_settings.py
app/settings.py
teleforma/admin.py
teleforma/locale/fr/LC_MESSAGES/django.mo
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/management/commands/teleforma-export-avis.py
teleforma/migrations/0005_auto_20220117_1756.py [new file with mode: 0644]
teleforma/models/core.py
teleforma/models/pro.py
teleforma/static/teleforma/css/teleforma.css
teleforma/templates/admin/teleforma/seminarrevision/change_list.html [deleted file]
teleforma/templates/registration/password_reset_email.html
teleforma/templatetags/teleforma_tags.py
teleforma/urls.py
teleforma/views/ae.py
teleforma/views/pro.py

index 7ef9b870371a1fd154f186d3f5f1fc1cd80365b8..b7b86de970140a01d8c5dc7e1b491d549e2b7225 100644 (file)
@@ -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'
index d34b56de0706afd09f90a7e4a2f694c770414e8b..4c55374bbf3f82aae0050cbd8d735074fdc404fd 100644 (file)
@@ -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'
index 2432810458810837e36740919f9a59aae3738d20..35563c084875331802a24b3c4d7f55083b3c7fb4 100644 (file)
@@ -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']
 
index b48f76f560fcb0e948b8a6fd3616e698a0a75f14..4027046e958be6616d473d3a1177e2f7f13b1f79 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ
index fd43c6aa0a47825f9faf4c6ee017981fb3fa640e..7cc7c467153839208f75bbd7a9ca876299e13884 100644 (file)
@@ -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
index a4bb4813a5295f2b095ccb7c33a0e99b67919bb0..abb9646fbbe1e4c811f38264e4c553d818a82f93 100644 (file)
@@ -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 (file)
index 0000000..e540a15
--- /dev/null
@@ -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'),
+        ),
+    ]
index 4783f1166303c053a1590bae15f7c48333b18901..82e396d57b486051df4e44d742126e967fa6d412 100755 (executable)
@@ -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)
index ad6a18bdf1404cbc3362297ad1fc7c7644f56e34..773aa525d5db65717315c39988df126fa29856c3 100644 (file)
@@ -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:
index b5382ba1d0b81a803971b955093d954bf81f55c8..7abbec88ba2c916ad33a49ba89e68a0414f70770 100644 (file)
@@ -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 (file)
index c5121c9..0000000
+++ /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 }}
-  {#  <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />#}
-  {% if cl.formset %}
-    {#    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />#}
-  {% endif %}
-  {% if cl.formset or action_form %}
-    {% url 'admin:jsi18n' as jsi18nurl %}
-    <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
-  {% endif %}
-  {{ media.css }}
-  {% if not actions_on_top and not actions_on_bottom %}
-    <style>
-      {#      #changelist table thead th:first-child {width: inherit}#}
-    </style>
-  {% endif %}
-{% endblock %}
-
-{% block extrahead %}
-  {{ block.super }}
-  {{ media.js }}
-  {% if action_form %}{% if actions_on_top or actions_on_bottom %}
-    <script type="text/javascript">
-      (function ($) {
-        $(document).ready(function ($) {
-          $("tr input.action-select").actions();
-        });
-      })(django.jQuery);
-    </script>
-  {% endif %}{% endif %}
-{% endblock %}
-
-{% block bodyclass %}change-list{% endblock %}
-
-{% if not is_popup %}
-  {% block breadcrumbs %}
-    <ul class="breadcrumb">
-      <li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        <span class="divider">&raquo;</span></li>
-      <li>
-        <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{% firstof opts.app_config.verbose_name app_label|capfirst|escape %}</a>
-        <span class="divider">&raquo;</span></li>
-      <li class="active">{{ cl.opts.verbose_name_plural|capfirst }}</li>
-    </ul>
-  {% endblock %}
-{% endif %}
-
-{% block coltype %}flex{% endblock %}
-
-{% block content %}
-
-  <div id="content-main">
-
-    <div class="inner-center-column">
-      <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
-
-        <div class="toolbar-content clearfix">
-          {% block object-tools %}
-            {% if has_add_permission %}
-              <div class="object-tools">
-                {% block object-tools-items %}
-                  <a href="{% url cl.opts|admin_urlname:'add' %}{% if is_popup %}?_popup=1{% endif %}" class="btn btn-success">
-                    <i class="icon-plus-sign icon-white"></i>&nbsp;
-                    {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
-                  </a>
-                {% endblock %}
-              </div>
-            {% endif %}
-          {% endblock %}
-
-          {% block search %}{% search_form cl %}{% endblock %}
-        </div>
-
-        {% block date_hierarchy %}
-          {% if cl.date_hierarchy %}
-            {% date_hierarchy cl %}
-          {% endif %}
-        {% endblock %}
-
-        {% if cl.formset.errors %}
-          <div class="alert alert-error errornote">
-            {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
-          </div>
-          {{ cl.formset.non_form_errors }}
-        {% endif %}
-
-        <form id="changelist-form" action="" method="post"
-            {% if cl.formset.is_multipart %}
-              enctype="multipart/form-data"{% endif %} class="form-inline">{% csrf_token %}
-          {% if cl.formset %}
-            <div>{{ cl.formset.management_form }}</div>
-          {% 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 %}
-              <div class="alert alert-block alert-info">
-                {% if cl.full_result_count %}
-                  <h4>{% trans 'Nothing found' %}!</h4>
-                  <br>
-                  <a href="?{% if cl.is_popup %}{{ POPUP_VAR }}=1{% endif %}">{% trans 'Reset search and filters' %}</a>
-                {% else %}
-                  {% blocktrans with cl.opts.verbose_name_plural|capfirst as name_plural %}{{ name_plural }} are not created yet{% endblocktrans %}.
-                  {% if has_add_permission %}<a href="{% url cl.opts|admin_urlname:'add' %}{% if is_popup %}?{{ POPUP_VAR }}=1{% endif %}">
-                    {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a>{% endif %}
-                {% endif %}
-              </div>
-            {% endif %}
-          {% endblock %}
-
-          {% block pagination %}
-            {% if cl.result_count %}
-              {% if action_form and actions_on_bottom and cl.full_result_count %}
-                <div class="below-actions">
-              {% endif %}
-              {% pagination cl %}
-              {% if action_form and actions_on_bottom and cl.full_result_count %}
-                </div>
-              {% endif %}
-            {% endif %}
-          {% endblock %}
-        </form>
-      </div>
-    </div>
-  </div>
-{% endblock %}
index 5bf161f6e07ef17f17cad0bf09ed271bba7ee56f..715e4fa9eddda236df1f20fd723785a6adaf8fe8 100644 (file)
@@ -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 }}
 
index 7d47c9163c589190bbd3d785aeff156bb544ff70..887a16d0643622d25e2fcf25df5710b956f82d25 100644 (file)
@@ -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'
index 32eaed73b8dd0b5c2ff6072102418615dbd3efb6..b0de260826872afa156ace865636cbc49fe7cf22 100644 (file)
@@ -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/<uidb64>/<token>/', PasswordResetConfirmView.as_view(
+    path('accounts/password_reset_confirm/<uidb64>/<token>/', 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"),
index e5dba08896ecc29c53616aac112160da614cc372..6323e2584694c1da175d43e9c22bb5df41a62628 100644 (file)
@@ -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
index 959d099b0f374e36b6419cb1e794e1245e60c5f8..077549f544bac4a2220cfeee3e6d333f0019ff71 100644 (file)
@@ -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: