Compare commits

..

No commits in common. "fae8882c21361e30c59c67b11e424955a149e07b" and "1a28e071e937d4aba40bd86a5d048d79ba93c136" have entirely different histories.

3 changed files with 14 additions and 16 deletions

View file

@ -23,7 +23,7 @@ DEVICE_TYPES = [
class DeviceForm(forms.Form):
type = forms.ChoiceField(choices = DEVICE_TYPES, required=False)
amount = forms.IntegerField(required=False, initial=1)
custom_id = forms.CharField(required=False)
customer_id = forms.CharField(required=False)
name = forms.CharField(required=False)
value = forms.CharField(required=False)
@ -49,8 +49,8 @@ class BaseDeviceFormSet(forms.BaseFormSet):
row["amount"] = d["amount"]
if d.get("name"):
row[d["name"]] = d.get("value", '')
if d.get("custom_id"):
row['CUSTOM_ID']= d["custom_id"]
if d.get("customer_id"):
row['CUSTOMER_ID']= d["customer_id"]
doc = create_doc(row)
if not commit:

View file

@ -40,6 +40,15 @@
{% endif %}
{{ form.management_form }}
<div class="container" id="formset-container">
<div class="row mb-2">
<div class="col"></div>
<div class="col-2 text-center">
<a href="javascript:void()" onclick="addForm(this);" type="button" class="btn btn-green-admin">
<i class="bi bi-plus"></i>
{% trans 'Add' %}
</a>
</div>
</div>
<div class="row mb-2">
<div class="col">
{% bootstrap_field form.0.type %}
@ -52,18 +61,7 @@
</div>
<div class="row mb-2">
<div class="col">
{% bootstrap_field form.0.custom_id %}
</div>
</div>
<div class="row mb-2">
<div class="col-10">
<span class="fw-bold">{% trans 'Component details' %}</span>
</div>
<div class="col-2 text-center">
<a href="javascript:void()" onclick="addForm(this);" type="button" class="btn btn-green-admin text-nowrap">
<i class="bi bi-plus"></i>
{% trans 'Add component' %}
</a>
{% bootstrap_field form.0.customer_id %}
</div>
</div>
{% for f in form %}

View file

@ -21,7 +21,7 @@ class NewDeviceView(DashboardView, FormView):
template_name = "new_device.html"
title = _("New Device")
breadcrumb = "Device / New Device"
success_url = reverse_lazy('dashboard:unassigned_devices')
success_url = reverse_lazy('device:add')
form_class = DeviceFormSet
def form_valid(self, form):