Ajout d'un import dédié fb pour traiter les problèmes rencontrés
This commit is contained in:
parent
05412cb43e
commit
17e57da36c
@ -304,10 +304,7 @@ def at_start(sender, **k):
|
|||||||
|
|
||||||
|
|
||||||
@app.task(bind=True)
|
@app.task(bind=True)
|
||||||
def run_all_recurrent_imports(self):
|
def run_all_recurrent_imports(self, only_fb=False):
|
||||||
# set variable to True for debugging fb
|
|
||||||
only_fb = False
|
|
||||||
|
|
||||||
from agenda_culturel.models import RecurrentImport
|
from agenda_culturel.models import RecurrentImport
|
||||||
|
|
||||||
logger.info("Run all imports")
|
logger.info("Run all imports")
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
<div class="slide-buttons">
|
<div class="slide-buttons">
|
||||||
{% if not status %}
|
{% if not status %}
|
||||||
<a href="{% url 'run_all_rimports' %}" role="button">Exécuter tout {% picto_from_name "play-circle" %}</a>
|
<a href="{% url 'run_all_rimports' %}" role="button">Exécuter tout {% picto_from_name "play-circle" %}</a>
|
||||||
|
<a href="{% url 'run_all_fb_rimports' %}" role="button">Exécuter depuis FB {% picto_from_name "play-circle" %}</a>
|
||||||
|
<br>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if status == "failed" or status == "canceled" %}
|
{% if status == "failed" or status == "canceled" %}
|
||||||
<a href="{% url 'run_all_rimports_status' status %}" role="button">Relancer les imports {% if status == "failed" %}échoués{% else %}annulés{% endif %} {% picto_from_name "play-circle" %}</a>
|
<a href="{% url 'run_all_rimports_status' status %}" role="button">Relancer les imports {% if status == "failed" %}échoués{% else %}annulés{% endif %} {% picto_from_name "play-circle" %}</a>
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
{% extends "agenda_culturel/page.html" %}
|
||||||
|
|
||||||
|
{% block title %}{% block og_title %}Lancer tous les imports facebook{% endblock %}{% endblock %}
|
||||||
|
|
||||||
|
{% block fluid %}{% endblock %}
|
||||||
|
|
||||||
|
{% block configurer-bouton %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<h1>Lancement de tous les imports</h1>
|
||||||
|
</header>
|
||||||
|
<form method="post">{% csrf_token %}
|
||||||
|
<p>Êtes-vous sûr·e de vouloir lancer tous les imports récurrent depuis facebook ?</p>
|
||||||
|
{{ form }}
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<div class="grid buttons">
|
||||||
|
<a href="{% if request.META.HTTP_REFERER %}{{ request.META.HTTP_REFERER }}{% else %}{% url 'recurrent_imports' %}{% endif %}" role="button" class="secondary">Annuler</a>
|
||||||
|
<input type="submit" value="Confirmer">
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -141,6 +141,7 @@ urlpatterns = [
|
|||||||
path("imports/<int:pk>/cancel", cancel_import, name="cancel_import"),
|
path("imports/<int:pk>/cancel", cancel_import, name="cancel_import"),
|
||||||
path("rimports/", recurrent_imports, name="recurrent_imports"),
|
path("rimports/", recurrent_imports, name="recurrent_imports"),
|
||||||
path("rimports/run", run_all_rimports, name="run_all_rimports"),
|
path("rimports/run", run_all_rimports, name="run_all_rimports"),
|
||||||
|
path("rimports/fb/run", run_all_fb_rimports, name="run_all_fb_rimports"),
|
||||||
path("rimports/status/<status>", recurrent_imports, name="recurrent_imports_status"),
|
path("rimports/status/<status>", recurrent_imports, name="recurrent_imports_status"),
|
||||||
path("rimports/status/<status>/run", run_all_rimports, name="run_all_rimports_status"),
|
path("rimports/status/<status>/run", run_all_rimports, name="run_all_rimports_status"),
|
||||||
path("rimports/add", RecurrentImportCreateView.as_view(), name="add_rimport"),
|
path("rimports/add", RecurrentImportCreateView.as_view(), name="add_rimport"),
|
||||||
|
@ -1462,6 +1462,20 @@ def run_all_rimports(request, status=None):
|
|||||||
return render(request, "agenda_culturel/run_all_rimports_confirm.html")
|
return render(request, "agenda_culturel/run_all_rimports_confirm.html")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/accounts/login/")
|
||||||
|
@permission_required(
|
||||||
|
["agenda_culturel.view_recurrentimport", "agenda_culturel.run_recurrentimport"]
|
||||||
|
)
|
||||||
|
def run_all_fb_rimports(request, status=None):
|
||||||
|
if request.method == "POST":
|
||||||
|
run_all_recurrent_imports.delay(True)
|
||||||
|
|
||||||
|
messages.success(request, _("Facebook imports has been launched."))
|
||||||
|
return HttpResponseRedirect(reverse_lazy("recurrent_imports"))
|
||||||
|
else:
|
||||||
|
return render(request, "agenda_culturel/run_all_fb_rimports_confirm.html")
|
||||||
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
## duplicated events
|
## duplicated events
|
||||||
#########################
|
#########################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user