
- Updated `item_incident.html` to implement ERP-style tabs for better navigation and added action icons for editing and deleting incidents. - Enhanced the overview tab with translated labels and improved layout for incident details. - Introduced linked risks and history tabs with appropriate translations and table structures. - Modified `item_risk.html` to include action icons for editing and deleting risks. - Refined `list_controls.html` to improve filter section layout and added translations for filter labels. - Updated `list_incidents.html` to enhance filter functionality and table layout, including translations for headers and buttons. - Improved `list_risks.html` by adding an action icon for adding new risks. - Adjusted `notifications.html` to enhance the display of new notifications with improved formatting and links.
49 lines
1.9 KiB
Python
49 lines
1.9 KiB
Python
from django import forms
|
|
from django.utils.translation import gettext_lazy as _
|
|
from .models import Risk, Control, Incident, ResidualRisk
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Base form for status field (DRY for Risk/Control/Incident)
|
|
# ---------------------------------------------------------------------------
|
|
class BaseStatusForm(forms.ModelForm):
|
|
"""Abstract base form for models with a 'status' field."""
|
|
class Meta:
|
|
fields = ["status"]
|
|
labels = {"status": _("Status")}
|
|
widgets = {"status": forms.Select(attrs={"class": "select"})}
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# RiskStatusForm
|
|
# ---------------------------------------------------------------------------
|
|
class RiskStatusForm(BaseStatusForm):
|
|
class Meta(BaseStatusForm.Meta):
|
|
model = Risk
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# ControlStatusForm
|
|
# ---------------------------------------------------------------------------
|
|
class ControlStatusForm(BaseStatusForm):
|
|
class Meta(BaseStatusForm.Meta):
|
|
model = Control
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# IncidentStatusForm
|
|
# ---------------------------------------------------------------------------
|
|
class IncidentStatusForm(BaseStatusForm):
|
|
class Meta(BaseStatusForm.Meta):
|
|
model = Incident
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# ResidualReviewForm
|
|
# ---------------------------------------------------------------------------
|
|
class ResidualReviewForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ResidualRisk
|
|
fields = ["review_required"]
|
|
labels = {"review_required": _("Review required")}
|
|
widgets = {"review_required": forms.CheckboxInput(attrs={"class": "checkbox"})}
|