Skip to content

Commit

Permalink
feat: allow to exclude fields from table columns
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jan 24, 2024
1 parent e5020be commit 92cba82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apis_core/generic/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ class GenericFilterSetForm(forms.Form):
"""

columns = forms.MultipleChoiceField(required=False)
columns_exclude = []

def __init__(self, *args, **kwargs):
model = kwargs.pop("model")
super().__init__(*args, **kwargs)
self.fields["columns"].choices = [
(field.name, field.verbose_name) for field in model._meta.fields
(field.name, field.verbose_name)
for field in model._meta.fields
if field.name not in self.columns_exclude
]

self.helper = FormHelper()
Expand Down

0 comments on commit 92cba82

Please sign in to comment.