Only show groups in reasonable states when showing current chartering efforts (otherwise crufty charter states can would lead to abandoned or replaced groups showing here). Fixes #2872. Commit ready for merge.

- Legacy-Id: 17246
This commit is contained in:
Robert Sparks 2020-01-17 20:14:22 +00:00
parent a48dab3fd1
commit 7c3a4ce3f5
2 changed files with 6 additions and 1 deletions

View file

@ -180,6 +180,11 @@ class GroupPagesTests(TestCase):
self.assertContains(r, "Charter new RG")
self.assertNotContains(r, "Charter new WG")
self.client.logout()
replaced_group = CharterFactory(group__state_id='replaced',group__type_id='wg',group__parent=GroupFactory(type_id='area'),states=[('charter','intrev')]).group
r = self.client.get(url)
q = PyQuery(r.content)
self.assertEqual(len(q('#content a:contains("%s")' % replaced_group.acronym)), 0)
def test_concluded_groups(self):
group = GroupFactory(state_id='conclude')

View file

@ -401,7 +401,7 @@ def chartering_groups(request):
group_types = GroupTypeName.objects.filter(slug__in=group_type_slugs)
for t in group_types:
t.chartering_groups = Group.objects.filter(type=t, charter__states__in=charter_states).select_related("state", "charter").order_by("acronym")
t.chartering_groups = Group.objects.filter(type=t, charter__states__in=charter_states,state_id__in=('active','bof','proposed','dormant')).select_related("state", "charter").order_by("acronym")
t.can_manage = can_manage_group_type(request.user, None, t.slug)
for g in t.chartering_groups: