From 5e14e85dab00ce1517d666b47b0318e288702e0a Mon Sep 17 00:00:00 2001 From: Horilla Date: Tue, 26 Mar 2024 14:12:35 +0530 Subject: [PATCH] [FIX] ASSET: Asset report disabled button and made the asset id field in the asset report form disabled and fixed pagination inside the asset category view --- asset/forms.py | 14 +++----------- asset/templates/asset/asset_list.html | 12 +++++++++++- asset/templates/category/asset_category.html | 6 +++--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/asset/forms.py b/asset/forms.py index 1fa66fa2f..b1c308769 100644 --- a/asset/forms.py +++ b/asset/forms.py @@ -162,17 +162,9 @@ class AssetReportForm(ModelForm): ] exclude = ["is_active"] - # def __init__(self, *args, **kwargs): - # super(AssetReportForm, self).__init__(*args, **kwargs) - # self.fields['documents'].queryset = AssetDocuments.objects.all() - - # def as_p(self, *args, **kwargs): - # """ - # Render the form fields as HTML table rows with Bootstrap styling. - # """ - # context = {"form": self} - # table_html = render_to_string("attendance_form.html", context) - # return table_html + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields['asset_id'].widget.attrs['disabled'] = 'disabled' class AssetCategoryForm(ModelForm): diff --git a/asset/templates/asset/asset_list.html b/asset/templates/asset/asset_list.html index 85b0cd089..96308c8e5 100644 --- a/asset/templates/asset/asset_list.html +++ b/asset/templates/asset/asset_list.html @@ -15,6 +15,7 @@ {% endif %} {% include 'filter_tags.html' %} +
@@ -120,8 +121,16 @@ title='{% trans "Asset Report" %}'> + {% else %} + + + {% endif %} - + {% if perms.asset.delete_asset %}
+
diff --git a/asset/templates/category/asset_category.html b/asset/templates/category/asset_category.html index 4798bcbe9..933bf11bd 100644 --- a/asset/templates/category/asset_category.html +++ b/asset/templates/category/asset_category.html @@ -25,7 +25,7 @@ class="oh-accordion-meta__header oh-accordion-meta__header--custom" data-target="#assetCategory{{asset_category.id}}" hx-get="{%url 'asset-list' cat_id=asset_category.id %}" - hx-target="#assetList{{asset_category.id}}"> + hx-target="#assetCategory{{asset_category.id}}">
-
-
+ {% comment %}
+
{% endcomment %}
{% endfor %}