state definition list changes and disabled logging
This commit is contained in:
parent
e42fb17877
commit
4ff884272c
|
@ -8,7 +8,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-end">
|
<div class="col text-end">
|
||||||
<button type="button" class="btn btn-green-admin" data-bs-toggle="modal" data-bs-target="#addStateModal">
|
<button type="button" class="btn btn-green-admin" data-bs-toggle="modal" data-bs-target="#addStateModal">
|
||||||
<i class="fas fa-plus text-secondary align-center p-1"></i>
|
|
||||||
{% trans "Add" %}
|
{% trans "Add" %}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,11 +22,9 @@
|
||||||
</caption>
|
</caption>
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" width="1%">
|
<th scope="col" width="5%" class="text-start">
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" width="7%" class="text-center">#
|
<th scope="col">{% trans "State Definition" %}
|
||||||
</th>
|
|
||||||
<th scope="col" class="">{% trans "State Definition" %}
|
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" width="15%" class="text-center">{% trans "Actions" %}
|
<th scope="col" width="15%" class="text-center">{% trans "Actions" %}
|
||||||
</th>
|
</th>
|
||||||
|
@ -41,42 +38,32 @@
|
||||||
class="align-items-center">
|
class="align-items-center">
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<i class="bi bi-grip-vertical text-muted" aria-hidden="true">
|
<i class="fas fa-light fa-grip" aria-hidden="true">
|
||||||
</i>
|
</i>
|
||||||
|
<strong class="ps-2">{{ state_definition.order }} </strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="fw-bold text-center">
|
<td class="font-monospace">
|
||||||
{{ state_definition.order }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ state_definition.state }}
|
{{ state_definition.state }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- action buttons -->
|
<!-- action buttons -->
|
||||||
<td class="text-center">
|
<td>
|
||||||
<div class="d-flex justify-content-center gap-1">
|
<div class="btn-group float-end">
|
||||||
<button
|
<button type="button" class="btn btn-sm btn-info text-white" data-bs-toggle="modal" data-bs-target="#editStateModal{{ state_definition.id }}">
|
||||||
type="button"
|
|
||||||
class="btn btn-sm btn-info"
|
|
||||||
data-bs-toggle="modal"
|
|
||||||
data-bs-target="#editStateModal{{ state_definition.id }}">
|
|
||||||
<i class="bi bi-pencil">
|
<i class="bi bi-pencil">
|
||||||
</i>
|
</i> {% trans 'Edit' %}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button type="button" class="btn btn-sm btn-danger" data-bs-toggle="modal" data-bs-target="#deleteStateModal{{ state_definition.id }}">
|
||||||
type="button"
|
|
||||||
id="delete-btn"
|
|
||||||
class="btn btn-sm btn-danger"
|
|
||||||
data-bs-toggle="modal"
|
|
||||||
data-bs-target="#deleteStateModal{{ state_definition.id }}">
|
|
||||||
<i class="bi bi-trash">
|
<i class="bi bi-trash">
|
||||||
</i>
|
</i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<form id="orderingForm" method="post" action="{% url 'admin:update_state_order' %}">
|
<form id="orderingForm" method="post" action="{% url 'admin:update_state_order' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -148,7 +135,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||||
<button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
|
<button type="submit" class="btn btn-green-admin">{% trans "Save Changes" %}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,6 @@ from user.models import User, Institution
|
||||||
from admin.email import NotifyActivateUserByEmail
|
from admin.email import NotifyActivateUserByEmail
|
||||||
from action.models import StateDefinition
|
from action.models import StateDefinition
|
||||||
|
|
||||||
device_logger = logging.getLogger('device_log')
|
|
||||||
|
|
||||||
class AdminView(DashboardView):
|
class AdminView(DashboardView):
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
|
@ -164,7 +163,6 @@ class AddStateDefinitionView(AdminView, StateDefinitionContextMixin, CreateView)
|
||||||
try:
|
try:
|
||||||
response = super().form_valid(form)
|
response = super().form_valid(form)
|
||||||
messages.success(self.request, _("State definition successfully added."))
|
messages.success(self.request, _("State definition successfully added."))
|
||||||
device_logger.info(f"<Created> StateDefinition with value {form.instance.state} by user {self.request.user}.")
|
|
||||||
return response
|
return response
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
messages.error(self.request, _("State is already defined."))
|
messages.error(self.request, _("State is already defined."))
|
||||||
|
|
Loading…
Reference in a new issue