Exemple #1
0
def edit(request, indicator_id):
    indicator = Indicator.objects.get(id=indicator_id)
    indicator_form = IndicatorForm(instance=indicator)
    if request.method == 'POST':
        indicator_form = IndicatorForm(data=request.POST, instance=indicator)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully edited.")
            return HttpResponseRedirect("/indicators/")
        messages.error(request, "Indicator was not successfully edited.")
    context = {'indicator_form': indicator_form, 'title': 'Edit Indicator', 'button_label': 'Save'}
    return render(request, 'indicator/new.html', context)
Exemple #2
0
def new(request):
    indicator_form = IndicatorForm()
    if request.method == 'POST':
        indicator_form = IndicatorForm(request.POST)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully created.")
            return HttpResponseRedirect("/indicators/")
        messages.error(request, "Indicator was not created.")
    return render(request, 'indicator/new.html',
                  {'indicator_form': indicator_form, 'title': 'Add Indicator', 'button_label': 'Create',
                   'cancel_url':'/indicators/', 'action': '/indicators/new/'})
Exemple #3
0
def edit(request, indicator_id):
    indicator = Indicator.objects.get(id=indicator_id)
    indicator_form = IndicatorForm(instance=indicator)
    if request.method == 'POST':
        indicator_form = IndicatorForm(data=request.POST, instance=indicator)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully edited.")
            return HttpResponseRedirect("/indicators/")
        messages.error(request, "Indicator was not successfully edited.")
    request.breadcrumbs([
        ('Indicators', reverse('list_indicator_page')),
    ])
    context = {
        'indicator_form': indicator_form,
        'title': 'Edit Indicator',
        'button_label': 'Save',
        'cancel_url': reverse('list_indicator_page')
    }
    return render(request, 'indicator/new.html', context)
Exemple #4
0
def new(request):
    indicator_form = IndicatorForm()
    if request.method == 'POST':
        indicator_form = IndicatorForm(request.POST)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully created.")
            return HttpResponseRedirect("/indicators/")
        messages.error(request, "Indicator was not created.")
    request.breadcrumbs([
        ('Indicators', reverse('list_indicator_page')),
    ])
    return render(
        request, 'indicator/new.html', {
            'indicator_form': indicator_form,
            'title': 'Add Indicator',
            'button_label': 'Create',
            'cancel_url': reverse('list_indicator_page'),
            'action': '/indicators/new/'
        })
Exemple #5
0
def edit(request, indicator_id):
    indicator = Indicator.objects.get(id=indicator_id)
    indicator_form = IndicatorForm(instance=indicator)
    if request.method == 'POST':
        indicator_form = IndicatorForm(data=request.POST, instance=indicator)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully edited.")
            return HttpResponseRedirect("/indicators/")
        messages.error(request, "Indicator was not successfully edited.")
    request.breadcrumbs([
        ('Indicators', reverse('list_indicator_page')),
    ])
    context = {
        'indicator_form': indicator_form,
        'title': 'Edit Indicator',
        'button_label': 'Save',
        'cancel_url': reverse('list_indicator_page'),
        'variable_form': IndicatorVariableForm(None)}
    return render(request, 'indicator/new.html', context)
Exemple #6
0
def new(request):
    """Creates new indicator. HTML uses with ajax to create variables on same screen with popups"""
    indicator_form = IndicatorForm()
    if request.method == 'POST':
        indicator_form = IndicatorForm(data=request.POST)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully created.")
            return HttpResponseRedirect(reverse('list_indicator_page'))
        messages.error(request, "Indicator was not created.")
    request.breadcrumbs([
        ('Indicators', reverse('list_indicator_page')),
    ])

    return render(request,
                  'indicator/new.html',
                  {'indicator_form': indicator_form,
                   'title': 'Add Indicator',
                   'button_label': 'Create',
                   'cancel_url': reverse('list_indicator_page'),
                   'action': '/indicators/new/',
                   'variable_form': IndicatorVariableForm(None)})
Exemple #7
0
def new(request):
    """Creates new indicator. HTML uses with ajax to create variables on same screen with popups"""
    indicator_form = IndicatorForm()
    if request.method == 'POST':
        indicator_form = IndicatorForm(data=request.POST)
        if indicator_form.is_valid():
            indicator_form.save()
            messages.success(request, "Indicator successfully created.")
            return HttpResponseRedirect(reverse('list_indicator_page'))
        messages.error(request, "Indicator was not created.")
    request.breadcrumbs([
        ('Indicators', reverse('list_indicator_page')),
    ])

    return render(
        request, 'indicator/new.html', {
            'indicator_form': indicator_form,
            'title': 'Add Indicator',
            'button_label': 'Create',
            'cancel_url': reverse('list_indicator_page'),
            'action': '/indicators/new/',
            'variable_form': IndicatorVariableForm(None)
        })