Skip to content

Commit

Permalink
apps: add label filter to django lists and maps for all modules using…
Browse files Browse the repository at this point in the history
… labels
  • Loading branch information
fuzzylogic2000 committed Oct 17, 2022
1 parent 9a69e9c commit abb9ff3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion meinberlin/apps/budgeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from adhocracy4.categories import filters as category_filters
from adhocracy4.exports.views import DashboardExportView
from adhocracy4.filters import filters as a4_filters
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from meinberlin.apps.ideas import views as idea_views
from meinberlin.apps.projects.views import ArchivedWidget
Expand All @@ -29,6 +30,7 @@ class ProposalFilterSet(a4_filters.DefaultsFilterSet):
'is_archived': 'false'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=get_ordering_choices
)
Expand All @@ -38,7 +40,7 @@ class ProposalFilterSet(a4_filters.DefaultsFilterSet):

class Meta:
model = models.Proposal
fields = ['category', 'is_archived']
fields = ['category', 'labels', 'is_archived']


class ProposalListView(idea_views.AbstractIdeaListView,
Expand Down
4 changes: 3 additions & 1 deletion meinberlin/apps/ideas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from adhocracy4.filters import views as filter_views
from adhocracy4.filters import widgets as filters_widgets
from adhocracy4.filters.filters import FreeTextFilter
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from adhocracy4.projects.mixins import ProjectMixin
from adhocracy4.rules import mixins as rules_mixins
Expand Down Expand Up @@ -43,6 +44,7 @@ class IdeaFilterSet(a4_filters.DefaultsFilterSet):
'ordering': '-created'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=get_ordering_choices
)
Expand All @@ -53,7 +55,7 @@ class IdeaFilterSet(a4_filters.DefaultsFilterSet):

class Meta:
model = models.Idea
fields = ['search', 'category']
fields = ['search', 'labels', 'category']


class AbstractIdeaListView(ProjectMixin,
Expand Down
4 changes: 3 additions & 1 deletion meinberlin/apps/kiezkasse/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from adhocracy4.categories import filters as category_filters
from adhocracy4.exports.views import DashboardExportView
from adhocracy4.filters import filters as a4_filters
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from meinberlin.apps.ideas import views as idea_views

Expand All @@ -24,13 +25,14 @@ class ProposalFilterSet(a4_filters.DefaultsFilterSet):
'ordering': '-created'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=get_ordering_choices
)

class Meta:
model = models.Proposal
fields = ['category']
fields = ['category', 'labels']


class ProposalListView(idea_views.AbstractIdeaListView,
Expand Down
4 changes: 3 additions & 1 deletion meinberlin/apps/mapideas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from adhocracy4.categories import filters as category_filters
from adhocracy4.exports.views import DashboardExportView
from adhocracy4.filters import filters as a4_filters
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from meinberlin.apps.ideas import views as idea_views

Expand All @@ -24,13 +25,14 @@ class MapIdeaFilterSet(a4_filters.DefaultsFilterSet):
'ordering': '-created'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=get_ordering_choices
)

class Meta:
model = models.MapIdea
fields = ['category']
fields = ['category', 'labels']


class MapIdeaListView(idea_views.AbstractIdeaListView,
Expand Down
7 changes: 5 additions & 2 deletions meinberlin/apps/maptopicprio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from adhocracy4.exports.views import DashboardExportView
from adhocracy4.filters import filters as a4_filters
from adhocracy4.filters import views as filter_views
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from adhocracy4.projects.mixins import ProjectMixin
from meinberlin.apps.ideas import views as idea_views
Expand All @@ -27,13 +28,14 @@ class MapTopicFilterSet(a4_filters.DefaultsFilterSet):
'ordering': '-created'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=get_ordering_choices
)

class Meta:
model = models.MapTopic
fields = ['category']
fields = ['category', 'labels']


class MapTopicCreateFilterSet(a4_filters.DefaultsFilterSet):
Expand All @@ -43,6 +45,7 @@ class MapTopicCreateFilterSet(a4_filters.DefaultsFilterSet):
}

category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()

ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=(
Expand All @@ -52,7 +55,7 @@ class MapTopicCreateFilterSet(a4_filters.DefaultsFilterSet):

class Meta:
model = models.MapTopic
fields = ['category']
fields = ['category', 'labels']


class MapTopicDetailView(idea_views.AbstractIdeaDetailView):
Expand Down
7 changes: 5 additions & 2 deletions meinberlin/apps/topicprio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from adhocracy4.filters import views as filter_views
from adhocracy4.filters import widgets as filters_widgets
from adhocracy4.filters.filters import FreeTextFilter
from adhocracy4.labels import filters as label_filters
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
from adhocracy4.projects.mixins import ProjectMixin
from meinberlin.apps.ideas import views as idea_views
Expand All @@ -25,6 +26,7 @@ class TopicFilterSet(a4_filters.DefaultsFilterSet):
'ordering': 'name'
}
category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()
ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=(
('name', _('Alphabetical')),
Expand All @@ -39,7 +41,7 @@ class TopicFilterSet(a4_filters.DefaultsFilterSet):

class Meta:
model = models.Topic
fields = ['search', 'category']
fields = ['search', 'category', 'labels']


class TopicListView(idea_views.AbstractIdeaListView,
Expand All @@ -66,6 +68,7 @@ class TopicCreateFilterSet(a4_filters.DefaultsFilterSet):
}

category = category_filters.CategoryFilter()
labels = label_filters.LabelFilter()

ordering = a4_filters.DynamicChoicesOrderingFilter(
choices=(
Expand All @@ -75,7 +78,7 @@ class TopicCreateFilterSet(a4_filters.DefaultsFilterSet):

class Meta:
model = models.Topic
fields = ['category']
fields = ['category', 'labels']


class TopicListDashboardView(ProjectMixin,
Expand Down

0 comments on commit abb9ff3

Please sign in to comment.