Skip to content

Commit 47a2174

Browse files
committed
Django 2.2 does not wrap single queries in transactions, for performance reasons. This caused some template tags that did database lookups to trigger exceptions. Fixed by moving the lookups (which would not normally change between apache reloads) out from the template tag code to module scope. Adding new groups of type ['ag','area','team','dir','program'] will now require a reload to show up in the group menu.
- Legacy-Id: 18086
1 parent 10b56c4 commit 47a2174

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

ietf/doc/templatetags/active_groups_menu.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
register = template.Library()
77

8+
parents = GroupTypeName.objects.filter(slug__in=['ag','area','team','dir','program'])
9+
810
@register.simple_tag
911
def active_groups_menu():
10-
parents = GroupTypeName.objects.filter(slug__in=['ag','area','team','dir','program'])
12+
global parents
1113
for p in parents:
1214
p.menu_url = '/%s/'%p.slug
1315
return render_to_string('base/menu_active_groups.html', { 'parents': parents })

ietf/doc/templatetags/wg_menu.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@
4343
'rai':'RAI'
4444
}
4545

46+
parents = Group.objects.filter(
47+
models.Q(type="area") | models.Q(type="irtf", acronym="irtf"),
48+
state="active"
49+
).order_by('type_id', 'acronym')
50+
4651
@register.simple_tag
4752
def wg_menu():
48-
parents = Group.objects.filter(models.Q(type="area") | models.Q(type="irtf", acronym="irtf"),
49-
state="active").order_by('type_id', 'acronym')
53+
global parents
5054

5155
for p in parents:
5256
p.short_name = area_short_names.get(p.acronym) or p.name

0 commit comments

Comments
 (0)