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

django.gettext is not a function in admin page #464

Open
useradd-temp opened this issue Nov 8, 2020 · 2 comments
Open

django.gettext is not a function in admin page #464

useradd-temp opened this issue Nov 8, 2020 · 2 comments

Comments

@useradd-temp
Copy link

useradd-temp commented Nov 8, 2020

django==3.1.2
django-3-jet==1.0.8

"django.gettext is not a function" occur on "admin/auth/group/add/", "admin/auth/user/add/" and other admin pages

image

I think it's a problem that occurs in the order in which "jsi18n" is called.

So I am using admin/base.html temporarily.

it is a temporary solution, I hope the code will be revised

{% extends 'admin/base.html' %}
{% load i18n static jet_tags %}
{% block html %}{{ block.super }}
        <script src="{% url 'jet:jsi18n' %}"></script>
{% endblock %}

{% block blockbots %}{{ block.super }}

    <script src="{% static 'admin/js/vendor/jquery/jquery.js' as url %}{{ url|jet_append_version }}"
            type="text/javascript"></script>
    <script src="{% static 'admin/js/jquery.init.js' as url %}{{ url|jet_append_version }}"></script>
{% endblock %}
@imamatory
Copy link

Same problem. Thanks, @helloracoon for the temporary solution.
Also, I think it should be mentioned that this snippet may be located in BASE_DIR/templates/admin/base.html. And don't forget to check that it should be resolved by template loader.

@ryanovas
Copy link

ryanovas commented Jan 15, 2022

I was just about to give up trying to fix this until I stumbled upon this issue, thanks @helloracoon

Here's the docs for overriding admin templates for others who come across this: https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#overriding-admin-templates

marianmazarovici added a commit to marianmazarovici/django-jet that referenced this issue Feb 2, 2022
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

3 participants