Ver Fonte

Fixes #11582: Fix missing VC form errors
### Fixes: #11582

Not sure if this is the correct fix or not. The reason that the custom field errors were not shown is that messages.html only shows non_field_errors if the form passed to the context is named form. This is probably an issue in more places, but not sure how to make it generic. A change to messages.html would also need to support formsets.

Any input appreciated @jeremystretch or @arthanson

kkthxbye-code há 3 anos atrás
pai
commit
3c970c331c

+ 2 - 0
netbox/templates/dcim/virtualchassis_add_member.html

@@ -5,6 +5,8 @@
 
 {% block content %}
     <form action="" method="post" enctype="multipart/form-data" class="form-object-edit">
+        {% render_errors membership_form %}
+        
         {% csrf_token %}
         <div class="card">
             <h5 class="card-header">Add New Member</h5>

+ 4 - 0
netbox/templates/dcim/virtualchassis_edit.html

@@ -8,6 +8,10 @@
   <div class="tab-content">
     <div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
       <form action="" method="post" enctype="multipart/form-data" class="form-object-edit">
+        {% for form in formset %}
+          {% render_errors form %}
+        {% endfor %}
+
         {% csrf_token %}
         {{ pk_form.pk }}
         {{ formset.management_form }}