geex-arts / django-jet

Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
https://github.com/jet-admin/jet-bridge
GNU Affero General Public License v3.0
3.57k stars 777 forks source link

Cant load custom dashboard #156

Open ZeusNabartey opened 7 years ago

ZeusNabartey commented 7 years ago

Hi. I cant load my custom dashboard. this is the error.

File "/home/Desktop/venv/local/lib/python2.7/site-packages/jet/dashboard/templatetags/jet_dashboard_tags.py", line 14, in get_dashboard return dashboard_cls(context, app_label=app_label) TypeError: 'NoneType' object is not callable

and this is the error in debug mode:

Error during template rendering

In template /home/Desktop/venv/local/lib/python2.7/site-packages/jet/dashboard/templates/admin/index.html, error at line 4 'NoneType' object is not callable 1 {% extends "admin/base_site.html" %} 2 {% load i18n admin_static jet_dashboard_tags static %} 3
4 {% block html %}{% get_dashboard 'index' as dashboard %}{{ block.super }}{% endblock %} 5
6 {% block extrastyle %} 7 {{ block.super }} 8 <link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" /> 9
10 {% for css in dashboard.media.css %} 11 12 {% endfor %} 13 {% endblock %} 14

what is the problem? Thanks

rl-yugandhar commented 7 years ago

Same behaviour is happening in my case as well. selection_033

vysakhvasanth commented 7 years ago

Hi Guys,

Have you registered the custom dashboard class properly? I faced the issue because I had wrong class name in config. Its worth checking.

rl-yugandhar commented 7 years ago

In my case, If it is loading properly for plain customDashboard. Above problem starts after have started integrating 'google-api-python-client'.

ThranduilUrMom commented 7 years ago

Hi ! I'm having the same problem when i try and do the google analytics custom dashboard and i checked my settings.py for mistakes in class name but it's all good, so have any of you found an actual solution to this probem

SalahAdDin commented 7 years ago

But did you installed the python package?

ThranduilUrMom commented 7 years ago

@SalahAdDin i think it's one of the first things we had to do according to the tutorial

SalahAdDin commented 7 years ago

If you want use google analitics you have to install these packages, also i think there are a problem with last version, there are other issue about it.

ZeusNabartey commented 7 years ago

I already fixed this problem. Where is the location of your dashboard.py? You should place it in the root directory of your project not together with settings.py. Please reply if that works. Thanks.

On Saturday, March 18, 2017 12:10 AM, Zakariae_Bou-taleb <notifications@github.com> wrote:

Hi ! I'm having the same problem when i try and do the google analytics custom dashboard and i checked my settings.py for mistakes in class name but it's all good, so have any of you found an actual solution to this probemβ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ThranduilUrMom commented 7 years ago

@ZeusNabartey I actually am putting the dashboard.py next to the manage.py file in my project root, but now i'm facing another problem with attaching the google analytics widgets, 'NoReverseMatch at /jet/dashboard/module/16/' i downgraded my google-api-python-client to version 1.4.x and upgraded it to the latest 1.6.x and the error stays in both versions

Ismael-VC commented 7 years ago

@ZeusNabartey

now i'm facing another problem

Please open another issue for it.

Can I assume you solved the original issue? If so how did you do it?

Ismael-VC commented 7 years ago

Sorry the mention above was meant for @ThranduilUrMom

I'm also having the same problem but only in one server, in my computer everything works fine, then I commit everything and push to repository. Then I cloned on the remote server, ran collectstatic, but it gives me the same error you get.

Ismael-VC commented 7 years ago

Please come to the django-jet Discord server so we can organize if you like:

Welcome! πŸ˜„

SalahAdDin commented 6 years ago

@Ismael-VC could you solve this problem?

PaoloC68 commented 6 years ago

I have this problem too

PaoloC68 commented 6 years ago

this is my code:


from __future__ import unicode_literals  
from __future__ import absolute_import  

from django.core.urlresolvers import reverse  
from django.utils.translation import ugettext_lazy as _  
from jet.dashboard import modules  
from jet.dashboard.dashboard import Dashboard, AppIndexDashboard  
from jet.utils import get_admin_site_name  

class DefaultIndexDashboard(Dashboard):  
    columns = 3  

    def init_with_context(self, context):  
        self.available_children.append(modules.LinkList)  
        self.available_children.append(modules.Feed)  

        site_name = get_admin_site_name(context)  
        # append a link list module for "quick links"  
        self.children.append(modules.LinkList(  
            _('Quick links'),  
            layout='inline',  
            draggable=False,  
            deletable=False,  
            collapsible=False,  
            children=[  
                [_('Return to site'), '/'],  
                [_('Change password'),  
                 reverse('%s:password_change' % site_name)],  
                [_('Log out'), reverse('%s:logout' % site_name)],  
            ],  
            column=0,  
            order=0  
        ))  

        # append an app list module for "Applications"  
        self.children.append(modules.AppList(  
            _('Applications'),  
            exclude=('auth.*',),  
            column=1,  
            order=0  
        ))  

        # append an app list module for "Administration"  
        self.children.append(modules.AppList(  
            _('Administration'),  
            models=('auth.*',),  
            column=2,  
            order=0  
        ))  

        # append a recent actions module  
        self.children.append(modules.RecentActions(  
            _('Recent Actions'),  
            10,  
            column=0,  
            order=1  
        ))  

        # append a feed module  
        self.children.append(modules.Feed(  
            _('Latest Django News'),  
            feed_url='http://www.djangoproject.com/rss/weblog/',  
            limit=5,  
            column=1,  
            order=1  
        ))  

        # append another link list module for "support".  
        self.children.append(modules.LinkList(  
            _('Support'),  
            children=[  
                {  
                    'title': _('Django documentation'),  
                    'url': 'http://docs.djangoproject.com/',  
                    'external': True,  
                },  
                {  
                    'title': _('Django "django-users" mailing list'),  
                    'url': 'http://groups.google.com/group/django-users',  
                    'external': True,  
                },  
                {  
                    'title': _('Django irc channel'),  
                    'url': 'irc://irc.freenode.net/django',  
                    'external': True,  
                },  
            ],  
            column=2,  
            order=1  
        ))

and in the settings: JET_INDEX_DASHBOARD = 'dashboard.DefaultIndexDashboard'

Which is exactly the same code as the one provided with the package

PaoloC68 commented 6 years ago

Once put the custom dashboard code within an app it worked, until in the project folder I got this issue

zvolsky commented 6 years ago

I want confirm same behaviour and same solution as ZeusNabartey, when you try follow the basic django-jet documentation: dashboard,py should be placed together with manage.py, not together with settings.py.

SalahAdDin commented 6 years ago

@zvolsky Can you put this in the docs? And, is it the same for production?

zvolsky commented 6 years ago

I made the proposal through jet.readthedocs.io, which have created PRΒ  https://github.com/geex-arts/django-jet/pull/288

I have no production server for this, it was just learning of the dashboard use.

Best regards,

Mirek

---------- PΕ―vodnΓ­ e-mail ---------- Od: JosΓ© Luis notifications@github.com Komu: geex-arts/django-jet django-jet@noreply.github.com Datum: 27. 1. 2018 23:31:36 PΕ™edmΔ›t: Re: [geex-arts/django-jet] Cant load custom dashboard (#156) " @zvolsky(https://github.com/zvolsky) Can you put this in the docs? And, is it the same for production?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/geex-arts/django-jet/issues/156#issuecomment-361020737), or mute the thread (https://github.com/notifications/unsubscribe-auth/AA-ubtA8x5yuzDO7IrMUly5LzmgyuqC5ks5tO6PDgaJpZM4LQHjX) .

"

expresspotato commented 5 years ago

So hours later the fix is both moving jet_dashboard.py / whatever you want to call it next to manage.py and for some reason you can't use a custom side JET_MENU, it's just going to crash later on.

danihodovic commented 5 years ago

I faced this issue when the pygal dependency was not installed.

pip install pygal

fixed it

SalahAdDin commented 5 years ago

is it required for the new version?

DavidLemayian commented 4 years ago

Managed to fix this and keep dashboard.py in my app folder:

.
β”œβ”€β”€ app
β”‚   β”œβ”€β”€ dashboard.py
β”‚   β”œβ”€β”€ settings.py
β”‚   └── ...
└── manage.py

and then in my settings.py:

JET_INDEX_DASHBOARD = 'app.dashboard.CustomIndexDashboard'
nxb303 commented 4 years ago

Managed to fix this and keep dashboard.py in my app folder:

.
β”œβ”€β”€ app
β”‚   β”œβ”€β”€ dashboard.py
β”‚   β”œβ”€β”€ settings.py
β”‚   └── ...
└── manage.py

and then in my settings.py:

JET_INDEX_DASHBOARD = 'app.dashboard.CustomIndexDashboard'

This fixed it for me, i forgot to add the app. in the JET_INDEX_DASHBOARD constant.

Fanevanjanahary commented 4 years ago

Managed to fix this and keep dashboard.py in my app folder:

.
β”œβ”€β”€ app
β”‚   β”œβ”€β”€ dashboard.py
β”‚   β”œβ”€β”€ settings.py
β”‚   └── ...
└── manage.py

and then in my settings.py:

JET_INDEX_DASHBOARD = 'app.dashboard.CustomIndexDashboard'

This works for me

brian-emarquez commented 1 year ago

It worked for me deleting the word index Setting .py

JET_DASHBOARD = 'app.dashboard.CustomIndexDashboard'
jayantamadhav commented 1 year ago

It worked for me deleting the word index Setting .py

JET_DASHBOARD = 'app.dashboard.CustomIndexDashboard'

This indeed stopped throwing error, but it wasn't loading my CustomIndexDashboard. I am using django-4-jet

Even though the error was 'NoneType' object is not callable but the underlying issue was different and took me a while to get to it. There is an ImportError in CustomIndexDashboard, you see its trying to import from django.utils.translation import ugettext_lazy as _ but django==4 (haven't tested django==3) doesn't export ugettext_lazy from django.utils.translation anymore.

Solution: use gettext_lazy from django.utils.translation import gettext_lazy as _ and it should be working.

Do not forget to reload widgets (refresh button in top right corner in admin console), otherwise the changes or your custom dashboard and its widgets will not be visible

RajatHcode commented 1 year ago

I am also getting same error when clicking on admin module. can anyone suggest how to resolve?? Screenshot from 2023-03-14 11-48-38