Skip to content

Commit

Permalink
budgeting/templatetags/react_proposal: fix is_voting_phase when no ph…
Browse files Browse the repository at this point in the history
…ase is active, fixes  #3988
  • Loading branch information
rine committed Dec 2, 2021
1 parent 4830b0b commit 1fd9c30
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions meinberlin/apps/budgeting/templatetags/react_proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
from django.urls import reverse
from django.utils.html import format_html

from adhocracy4.phases.predicates import has_feature_active
from meinberlin.apps.budgeting.models import Proposal

register = template.Library()


@register.simple_tag(takes_context=True)
def react_proposals(context, obj):
proposals_api_url = reverse('proposals-list', kwargs={'module_pk': obj.pk})
def react_proposals(context, module):
proposals_api_url = reverse('proposals-list',
kwargs={'module_pk': module.pk})
attributes = {'proposals_api_url': proposals_api_url,
'is_voting_phase': 'voting' in obj.active_phase.type}
'is_voting_phase': has_feature_active(module,
Proposal,
'vote')
}

return format_html(
'<div data-mb-widget="proposals" '
Expand Down

0 comments on commit 1fd9c30

Please sign in to comment.