fix(base): add missing content_title to context

!35 #74
This commit is contained in:
2024-07-10 15:58:18 +09:30
parent 25efa31493
commit ee3dd68cfe
4 changed files with 15 additions and 4 deletions

View File

@ -55,9 +55,11 @@ class OrganizationMixin():
id = obj.get_organization().id
if obj.is_global:
if hasattr(obj, 'is_global'):
id = 0
if obj.is_global:
id = 0
except AttributeError:

View File

@ -1,6 +1,5 @@
{% extends 'base.html.j2' %}
{% block title %}Organizations{% endblock %}
{% block content_header_icon %}{% endblock %}
{% block content %}

View File

@ -18,6 +18,14 @@ class IndexView(OrganizationPermission, generic.ListView):
context_object_name = "organization_list"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['content_title'] = 'Organizations'
return context
def get_queryset(self):
if self.request.user.is_superuser:
@ -75,6 +83,8 @@ class View(OrganizationPermission, generic.UpdateView):
context['model_pk'] = self.kwargs['pk']
context['model_name'] = self.model._meta.verbose_name.replace(' ', '')
context['content_title'] = 'Organization - ' + context[self.context_object_name].name
return context

View File

@ -4,7 +4,7 @@
<head>
{% load static %}
<title>{{ content_title }} - {% settings_value "SITE_TITLE" %}</title>
<title>{{ content_title | default_if_none:"" }} - {% settings_value "SITE_TITLE" %}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">