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
This commit is contained in:
parent
10b56c4e33
commit
47a2174e80
|
@ -5,9 +5,11 @@ from ietf.name.models import GroupTypeName
|
|||
|
||||
register = template.Library()
|
||||
|
||||
parents = GroupTypeName.objects.filter(slug__in=['ag','area','team','dir','program'])
|
||||
|
||||
@register.simple_tag
|
||||
def active_groups_menu():
|
||||
parents = GroupTypeName.objects.filter(slug__in=['ag','area','team','dir','program'])
|
||||
global parents
|
||||
for p in parents:
|
||||
p.menu_url = '/%s/'%p.slug
|
||||
return render_to_string('base/menu_active_groups.html', { 'parents': parents })
|
||||
|
|
|
@ -43,10 +43,14 @@ area_short_names = {
|
|||
'rai':'RAI'
|
||||
}
|
||||
|
||||
parents = Group.objects.filter(
|
||||
models.Q(type="area") | models.Q(type="irtf", acronym="irtf"),
|
||||
state="active"
|
||||
).order_by('type_id', 'acronym')
|
||||
|
||||
@register.simple_tag
|
||||
def wg_menu():
|
||||
parents = Group.objects.filter(models.Q(type="area") | models.Q(type="irtf", acronym="irtf"),
|
||||
state="active").order_by('type_id', 'acronym')
|
||||
global parents
|
||||
|
||||
for p in parents:
|
||||
p.short_name = area_short_names.get(p.acronym) or p.name
|
||||
|
|
Loading…
Reference in a new issue