From c6fc60c3c1d7a7672f2f155d091286bdae3a9563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 16 Mar 2019 09:56:14 +0100 Subject: [PATCH] misc: remove validation steps (#31454) --- welco/settings.py | 10 ------ welco/templates/welco/qualification.html | 26 --------------- welco/urls.py | 1 - welco/views.py | 42 +----------------------- 4 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 welco/templates/welco/qualification.html diff --git a/welco/settings.py b/welco/settings.py index 83bb858..02e3e58 100644 --- a/welco/settings.py +++ b/welco/settings.py @@ -185,16 +185,6 @@ HAYSTACK_CONNECTIONS = { HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' -# Add validation circuit on specific sources, example: -# VALIDATION_STEPS = {'mail': ['done-qualif', 'done-dgs', 'done-dga']} -# VALIDATION_STEP_LABELS = { -# 'done-qualif': _('Send to DGS'), -# 'done-dgs': _('Send to DGA'), -# 'done-dga': _('Send to service')} - -VALIDATION_STEPS = {} -VALIDATION_STEP_LABELS = {} - # mapping of channel to group/role *names* CHANNEL_ROLES = { 'mail': [], diff --git a/welco/templates/welco/qualification.html b/welco/templates/welco/qualification.html deleted file mode 100644 index 3fc21e9..0000000 --- a/welco/templates/welco/qualification.html +++ /dev/null @@ -1,26 +0,0 @@ -{% load i18n %} -
-{% if source_pk %} -
- {% if associations|length %} -
    - {% for association in associations %} -
  • {{association.formdef_name}} - {% if not association.formdata_id %} - ()
  • - {% endif %} - {% endfor %} -
  • {% trans 'Add another' %}
  • -
- {% endif %} - -
-
- {{form.formdef_reference}} -
- -
- -
-{% endif %} -
diff --git a/welco/urls.py b/welco/urls.py index e7e69b3..9712223 100644 --- a/welco/urls.py +++ b/welco/urls.py @@ -39,7 +39,6 @@ urlpatterns = [ url(r'^', include('welco.sources.phone.urls')), url(r'^', include('welco.sources.counter.urls')), url(r'^ajax/qualification$', welco.views.qualification, name='qualif-zone'), - url(r'^ajax/qualification-done$', welco.views.qualification_done, name='qualif-done'), url(r'^ajax/remove-association/(?P\w+)$', welco.views.remove_association, name='ajax-remove-association'), url(r'^ajax/create-formdata/(?P\w+)$', diff --git a/welco/views.py b/welco/views.py index d15277a..ad6ed49 100644 --- a/welco/views.py +++ b/welco/views.py @@ -67,13 +67,7 @@ def logout(request, next_page=None): class Qualification(TemplateView): - def get_template_names(self): - source_type = ContentType.objects.get(id=self.request.GET['source_type']) - validation_steps = settings.VALIDATION_STEPS.get(source_type.model.lower()) - if validation_steps: - return ['welco/qualification.html'] - else: - return ['welco/qualification_no_validation.html'] + template_name = 'welco/qualification_no_validation.html' def get_context_data(self, **kwargs): context = super(Qualification, self).get_context_data(**kwargs) @@ -86,9 +80,6 @@ class Qualification(TemplateView): context['associations'] = Association.objects.filter( source_type=ContentType.objects.get(id=self.request.GET['source_type']), source_pk=self.request.GET['source_pk']).order_by('id') - validation_steps = settings.VALIDATION_STEPS.get(source_type.model.lower()) or [] - context['validation_steps'] = [ - {'id': x, 'label': settings.VALIDATION_STEP_LABELS[x]} for x in validation_steps] return context def post(self, request, *args, **kwargs): @@ -157,37 +148,6 @@ class HomeCounter(ChannelHome): home_counter = login_required(HomeCounter.as_view()) - -@csrf_exempt -def qualification_done(request): - source_class = ContentType.objects.get( - id=request.POST['source_type']).model_class() - source_object = source_class.objects.get(id=request.POST['source_pk']) - validation_steps = settings.VALIDATION_STEPS.get(source_class.__name__.lower()) - if request.GET.get('step'): - source_object.status = validation_steps[validation_steps.index(request.GET.get('step'))] - else: - if source_object.status: - source_object.status = validation_steps[ - validation_steps.index(source_object.status)+1] - else: - source_object.status = validation_steps[0] - if source_object.status == validation_steps[-1]: - for association in Association.objects.filter( - source_type=request.POST['source_type'], - source_pk=request.POST['source_pk']): - try: - association.push(request) - except Exception, e: - response = HttpResponse(content_type='application/json') - json.dump({'err': '1', 'msg': str(e)}, response, indent=2) - return response - source_object.save() - response = HttpResponse(content_type='application/json') - json.dump({'result': 'ok'}, response, indent=2) - return response - - @login_required def wcs_summary(request, *args, **kwargs): source_class = ContentType.objects.get(id=kwargs.get('source_type')).model_class()