misc: remove validation steps (#31454)

This commit is contained in:
Frédéric Péters 2019-03-16 09:56:14 +01:00
parent 5bcd9442b9
commit c6fc60c3c1
4 changed files with 1 additions and 78 deletions

View File

@ -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': [],

View File

@ -1,26 +0,0 @@
{% load i18n %}
<div {% if not source_pk %}class="inactive"{% endif %}>
{% if source_pk %}
<form>
{% if associations|length %}
<ul>
{% for association in associations %}
<li>{{association.formdef_name}}
{% if not association.formdata_id %}
(<a class="remove" href="{% url 'ajax-remove-association' pk=association.id %}"></a>)</li>
{% endif %}
{% endfor %}
<li><a href="#" class="plus">{% trans 'Add another' %}</a></li>
</ul>
{% endif %}
<div class="add-formdef-reference" {% if associations|length %}style="display: none"{% endif %}>
<div>
{{form.formdef_reference}}
</div>
<button class="add">{% trans 'Add' %}</button>
</div>
</form>
{% endif %}
</div>

View File

@ -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<pk>\w+)$',
welco.views.remove_association, name='ajax-remove-association'),
url(r'^ajax/create-formdata/(?P<pk>\w+)$',

View File

@ -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()