parent
f17f24b6c2
commit
18432829b8
@ -11,6 +11,7 @@ from celery.utils.log import get_task_logger
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
from .import_tasks.custom_extractors import (
|
from .import_tasks.custom_extractors import (
|
||||||
lacomedie,
|
lacomedie,
|
||||||
@ -367,10 +368,13 @@ def run_all_recurrent_imports(self, only_fb=False):
|
|||||||
logger.info("Run all imports")
|
logger.info("Run all imports")
|
||||||
if only_fb:
|
if only_fb:
|
||||||
imports = RecurrentImport.objects.filter(
|
imports = RecurrentImport.objects.filter(
|
||||||
processor=RecurrentImport.PROCESSOR.FBEVENTS
|
Q(processor=RecurrentImport.PROCESSOR.FBEVENTS)
|
||||||
|
& ~Q(recurrence=RecurrentImport.RECURRENCE.NEVER)
|
||||||
).order_by("pk")
|
).order_by("pk")
|
||||||
else:
|
else:
|
||||||
imports = RecurrentImport.objects.all().order_by("pk")
|
imports = RecurrentImport.objects.filter(
|
||||||
|
~Q(recurrence=RecurrentImport.RECURRENCE.NEVER)
|
||||||
|
).order_by("pk")
|
||||||
|
|
||||||
run_recurrent_imports_from_list([imp.pk for imp in imports])
|
run_recurrent_imports_from_list([imp.pk for imp in imports])
|
||||||
|
|
||||||
@ -380,7 +384,9 @@ def run_all_recurrent_imports_failed(self):
|
|||||||
from agenda_culturel.models import BatchImportation, RecurrentImport
|
from agenda_culturel.models import BatchImportation, RecurrentImport
|
||||||
|
|
||||||
logger.info("Run only failed imports")
|
logger.info("Run only failed imports")
|
||||||
imports = RecurrentImport.objects.all().order_by("pk")
|
imports = RecurrentImport.objects.filter(
|
||||||
|
~Q(recurrence=RecurrentImport.RECURRENCE.NEVER)
|
||||||
|
).order_by("pk")
|
||||||
imports = [(imp.pk, imp.last_import()) for imp in imports]
|
imports = [(imp.pk, imp.last_import()) for imp in imports]
|
||||||
|
|
||||||
run_recurrent_imports_from_list(
|
run_recurrent_imports_from_list(
|
||||||
@ -397,7 +403,9 @@ def run_all_recurrent_imports_canceled(self):
|
|||||||
from agenda_culturel.models import BatchImportation, RecurrentImport
|
from agenda_culturel.models import BatchImportation, RecurrentImport
|
||||||
|
|
||||||
logger.info("Run only canceled imports")
|
logger.info("Run only canceled imports")
|
||||||
imports = RecurrentImport.objects.all().order_by("pk")
|
imports = RecurrentImport.objects.filter(
|
||||||
|
~Q(recurrence=RecurrentImport.RECURRENCE.NEVER)
|
||||||
|
).order_by("pk")
|
||||||
imports = [(imp.pk, imp.last_import()) for imp in imports]
|
imports = [(imp.pk, imp.last_import()) for imp in imports]
|
||||||
|
|
||||||
run_recurrent_imports_from_list(
|
run_recurrent_imports_from_list(
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 4.2.19 on 2025-03-02 21:54
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("agenda_culturel", "0151_referencelocation_slug"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="recurrentimport",
|
||||||
|
name="recurrence",
|
||||||
|
field=models.CharField(
|
||||||
|
choices=[("daily", "daily"), ("weekly", "weekly"), ("never", "never")],
|
||||||
|
default="daily",
|
||||||
|
max_length=10,
|
||||||
|
verbose_name="Import recurrence",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
@ -2504,6 +2504,7 @@ class RecurrentImport(models.Model):
|
|||||||
_("daily"),
|
_("daily"),
|
||||||
)
|
)
|
||||||
WEEKLY = "weekly", _("weekly")
|
WEEKLY = "weekly", _("weekly")
|
||||||
|
NEVER = "never", _("never")
|
||||||
|
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
verbose_name=_("Name"),
|
verbose_name=_("Name"),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% load i18n %}
|
||||||
<div class="large-table">
|
<div class="large-table">
|
||||||
<table role="grid">
|
<table role="grid">
|
||||||
<thead>
|
<thead>
|
||||||
@ -47,7 +48,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span {% if obj.status == "failed" %}data-tooltip="{{ obj.error_message }}"{% endif %}>{{ obj.status }}</span>
|
<span {% if obj.status == "failed" %}data-tooltip="{{ obj.error_message }}"{% endif %}>{% trans obj.status %}</span>
|
||||||
{% if obj.status == "running" %}
|
{% if obj.status == "running" %}
|
||||||
(<a href="{% url 'cancel_import' obj.id %}">annuler</a>)
|
(<a href="{% url 'cancel_import' obj.id %}">annuler</a>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{% block og_title %}Import récurrent #{{ object.pk }}{% endblock %}
|
{% block og_title %}Import récurrent #{{ object.pk }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% load cat_extra %}
|
{% load cat_extra %}
|
||||||
|
{% load i18n %}
|
||||||
{% load utils_extra %}
|
{% load utils_extra %}
|
||||||
{% load tag_extra %}
|
{% load tag_extra %}
|
||||||
{% block entete_header %}
|
{% block entete_header %}
|
||||||
@ -42,7 +43,7 @@
|
|||||||
<strong>Téléchargeur :</strong> {{ object.downloader }}
|
<strong>Téléchargeur :</strong> {{ object.downloader }}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Recurrence :</strong> {{ object.recurrence }}
|
<strong>Recurrence :</strong> {% trans object.recurrence %}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Source :</strong> <a href="{{ object.source }}">{{ object.source }}</a>
|
<strong>Source :</strong> <a href="{{ object.source }}">{{ object.source }}</a>
|
||||||
|
@ -197,7 +197,11 @@ def mentions_legales(request):
|
|||||||
|
|
||||||
|
|
||||||
def about(request):
|
def about(request):
|
||||||
rimports = RecurrentImport.objects.order_by("name__unaccent").all()
|
rimports = (
|
||||||
|
RecurrentImport.objects.filter(~Q(recurrence=RecurrentImport.RECURRENCE.NEVER))
|
||||||
|
.order_by("name__unaccent")
|
||||||
|
.all()
|
||||||
|
)
|
||||||
context = {
|
context = {
|
||||||
"title": "À propos",
|
"title": "À propos",
|
||||||
"static_content": "about",
|
"static_content": "about",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user