Beispiel #1
0
def add_meta_data(request, pid):
    prod = Product.objects.get(id=pid)
    if request.method == 'POST':
        form = DojoMetaDataForm(request.POST, instance=DojoMeta(product=prod))
        if form.is_valid():
            form.save()
            messages.add_message(request,
                                 messages.SUCCESS,
                                 'Metadata added successfully.',
                                 extra_tags='alert-success')
            if 'add_another' in request.POST:
                return HttpResponseRedirect(
                    reverse('add_meta_data', args=(pid, )))
            else:
                return HttpResponseRedirect(
                    reverse('view_product', args=(pid, )))
    else:
        form = DojoMetaDataForm()

    product_tab = Product_Tab(pid, title="Add Metadata", tab="settings")

    return render(request, 'dojo/add_product_meta_data.html', {
        'form': form,
        'product_tab': product_tab,
        'product': prod,
    })
Beispiel #2
0
def add_meta_data(request, pid):
    prod = Product.objects.get(id=pid)
    if request.method == 'POST':
        form = DojoMetaDataForm(request.POST, instance=DojoMeta(product=prod))
        if form.is_valid():
            form.save()
            messages.add_message(request,
                                 messages.SUCCESS,
                                 'Metadata added successfully.',
                                 extra_tags='alert-success')
            if 'add_another' in request.POST:
                return HttpResponseRedirect(reverse('add_meta_data', args=(pid,)))
            else:
                return HttpResponseRedirect(reverse('view_product', args=(pid,)))
    else:
        form = DojoMetaDataForm()

    product_tab = Product_Tab(pid, title="Add Metadata", tab="settings")

    return render(request,
                  'dojo/add_product_meta_data.html',
                  {'form': form,
                   'product_tab': product_tab,
                   'product': prod,
                   })
Beispiel #3
0
def add_meta_data(request, eid):
    endpoint = Endpoint.objects.get(id=eid)
    if request.method == 'POST':
        form = DojoMetaDataForm(request.POST,
                                instance=DojoMeta(endpoint=endpoint))
        if form.is_valid():
            form.save()
            messages.add_message(request,
                                 messages.SUCCESS,
                                 'Metadata added successfully.',
                                 extra_tags='alert-success')
            if 'add_another' in request.POST:
                return HttpResponseRedirect(
                    reverse('add_meta_data', args=(eid, )))
            else:
                return HttpResponseRedirect(
                    reverse('view_endpoint', args=(eid, )))
    else:
        form = DojoMetaDataForm()

    add_breadcrumb(parent=endpoint,
                   title="Add Metadata",
                   top_level=False,
                   request=request)
    product_tab = Product_Tab(endpoint.product.id,
                              "Add Metadata",
                              tab="endpoints")
    return render(request, 'dojo/add_endpoint_meta_data.html', {
        'form': form,
        'product_tab': product_tab,
        'endpoint': endpoint,
    })
Beispiel #4
0
def add_meta_data(request, eid):
    endpoint = Endpoint.objects.get(id=eid)
    if request.method == 'POST':
        form = DojoMetaDataForm(request.POST, instance=DojoMeta(endpoint=endpoint))
        if form.is_valid():
            form.save()
            messages.add_message(request,
                                 messages.SUCCESS,
                                 'Metadata added successfully.',
                                 extra_tags='alert-success')
            if 'add_another' in request.POST:
                return HttpResponseRedirect(reverse('add_meta_data', args=(eid,)))
            else:
                return HttpResponseRedirect(reverse('view_endpoint', args=(eid,)))
    else:
        form = DojoMetaDataForm()

    add_breadcrumb(parent=endpoint, title="Add Metadata", top_level=False, request=request)
    product_tab = Product_Tab(endpoint.product.id, "Add Metadata", tab="endpoints")
    return render(request,
                  'dojo/add_endpoint_meta_data.html',
                  {'form': form,
                   'product_tab': product_tab,
                   'endpoint': endpoint,
                   })