diff --git a/apps/jars/templates/jars_conf_edit_pro.html b/apps/jars/templates/jars_conf_edit_pro.html new file mode 100644 index 0000000..6dc1d97 --- /dev/null +++ b/apps/jars/templates/jars_conf_edit_pro.html @@ -0,0 +1,47 @@ +{% extends "dev_conf_edit.html" %} +{% load bootstrap3 %} +{% load static %} +{% load main_tags %} + +{% block extra-js%} + +{% endblock %} \ No newline at end of file diff --git a/apps/jars/templates/jars_conf_edit_raw.html b/apps/jars/templates/jars_conf_edit_raw.html new file mode 100644 index 0000000..6dc1d97 --- /dev/null +++ b/apps/jars/templates/jars_conf_edit_raw.html @@ -0,0 +1,47 @@ +{% extends "dev_conf_edit.html" %} +{% load bootstrap3 %} +{% load static %} +{% load main_tags %} + +{% block extra-js%} + +{% endblock %} \ No newline at end of file diff --git a/apps/jars/views.py b/apps/jars/views.py index 539b689..b568542 100644 --- a/apps/jars/views.py +++ b/apps/jars/views.py @@ -64,4 +64,40 @@ def jars_conf_edit(request, id_conf): kwargs['suptitle'] = 'Edit' kwargs['button'] = 'Save' - return render(request, 'jars_conf_edit.html', kwargs) \ No newline at end of file + return render(request, 'jars_conf_edit.html', kwargs) + +def jars_conf_edit_prueba(request, id_conf, type): + + conf = get_object_or_404(JARSConfiguration, pk=id_conf) + + if request.method=='GET': + if type == 'PDATA': + form = JARSConfigurationForm_Pro(instance=conf) + html = 'jars_conf_edit_pro.html' + else: + form = JarsConfigurationForm_Raw(instance=conf) + html = 'jars_conf_edit_raw.html' + + if request.method=='POST': + if type == 'PDATA': + form = JARSConfigurationForm_Pro(instance=conf) + html = 'jars_conf_edit_pro.html' + else: + form = JarsConfigurationForm_Raw(instance=conf) + html = 'jars_conf_edit_raw.html' + + if form.is_valid(): + conf = form.save(commit=False) + conf.save() + return redirect('url_jars_conf', id_conf=conf.id) + + ##ERRORS + + kwargs = {} + kwargs['id_dev'] = conf.id + kwargs['form'] = form + kwargs['title'] = 'Device Configuration' + kwargs['suptitle'] = 'Edit' + kwargs['button'] = 'Save' + + return render(request, html, kwargs) \ No newline at end of file