Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding AdminSite site_header #26

Open
mingfeng opened this issue Oct 8, 2020 · 1 comment
Open

Allow overriding AdminSite site_header #26

mingfeng opened this issue Oct 8, 2020 · 1 comment

Comments

@mingfeng
Copy link

mingfeng commented Oct 8, 2020

django-helusers overrides the AdminSite and change the site_header to be a read-only property (see below), which prevents the client code assigning a custom site header to it.

    @property
    def site_header(self):
        if 'django.contrib.sites' in settings.INSTALLED_APPS:
            Site = apps.get_model(app_label='sites', model_name='Site')
            site = Site.objects.get_current()
            site_name = site.name
        elif hasattr(settings, 'WAGTAIL_SITE_NAME'):
            site_name = settings.WAGTAIL_SITE_NAME
        else:
            return ugettext_lazy("Django admin")
        return ugettext_lazy("%(site_name)s admin") % {'site_name': site_name}

While it's possible to set WAGTAIL_SITE_NAME setting variable to change the admin site header, but it's confusing for those projects that does not use WAGTAIL.

It would be nice to add a set property for site_header also.

@akikoskinen
Copy link
Contributor

Isn't it possible to extend helusers.admin_site.AdminSite and write your own site_header property? If that's too cumbersome or otherwise not desirable, I guess, contributions are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants