django-jet
django-jet copied to clipboard
Cant load custom dashboard
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
Same behaviour is happening in my case as well.
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.
In my case, If it is loading properly for plain customDashboard. Above problem starts after have started integrating 'google-api-python-client'.
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
But did you installed the python package?
@SalahAdDin i think it's one of the first things we had to do according to the tutorial
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.
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 <[email protected]> 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.
@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
@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?
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.
Please come to the django-jet Discord server so we can organize if you like:
- https://discord.gg/3yr5yeH
Welcome! π
@Ismael-VC could you solve this problem?
I have this problem too
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
Once put the custom dashboard code within an app it worked, until in the project folder I got this issue
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.
@zvolsky Can you put this in the docs? And, is it the same for production?
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 [email protected] Komu: geex-arts/django-jet [email protected] 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) .
"
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.
I faced this issue when the pygal
dependency was not installed.
pip install pygal
fixed it
is it required for the new version?
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'
Managed to fix this and keep
dashboard.py
in myapp
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.
Managed to fix this and keep
dashboard.py
in myapp
folder:. βββ app β βββ dashboard.py β βββ settings.py β βββ ... βββ manage.py
and then in my
settings.py
:JET_INDEX_DASHBOARD = 'app.dashboard.CustomIndexDashboard'
This works for me
It worked for me deleting the word index Setting .py
JET_DASHBOARD = 'app.dashboard.CustomIndexDashboard'
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
I am also getting same error when clicking on admin module. can anyone suggest how to resolve??