Reputation: 1663
Can't for the life of me figure out what the issue is. Help please!
I'm trying to extend the admin view (using the xadmin app), by including a chart
The issue started appearing with the addition of:
admin
from xadmin import views
from .models import DGISummary
...
@xadmin.sites.register(views.website.IndexView)
class MainDashboard(object):
widgets = [
[
{
"type": "chart",
"model": "dgisummary",
"chart": "reg_members",
"params":
{
"_p_date__gte": "2017-01-01",
"p": 1,
"_p_date__lt": "2017-12-01"
}
},
],
]
model
@python_2_unicode_compatible
class DGISummary(models.Model):
quarter = models.CharField(max_length=2,)
reg_members = models.IntegerField()
sub_received = models.IntegerField()
...
class Meta:
verbose_name = u"Summary"
verbose_name_plural = verbose_name
def __str__(self):
return self.quarter
And the traceback
System check identified no issues (0 silenced).
February 20, 2018 - 15:38:35
Django version 1.11.10, using settings 'csa_portal.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
ERROR:root:No installed app with label 'app'.
Traceback (most recent call last):
File "C:/../apps\xadmin\views\dashboard.py", line 563, in get_widgets
ws.append(self.get_widget(widget))
File "C:/../apps\xadmin\views\base.py", line 78, in method
return filter_chain(filters, len(filters) - 1, _inner_method, *args, **kwargs)
File "C:/../apps\xadmin\views\base.py", line 47, in filter_chain
return func()
File "C:/../apps\xadmin\views\base.py", line 72, in _inner_method
return func(self, *args, **kwargs)
File "C:/../apps\xadmin\views\dashboard.py", line 517, in get_widget
wid_instance = widget_with_perm(self, data or widget.get_value())
File "C:/../apps\xadmin\views\dashboard.py", line 325, in __init__
super(ModelBaseWidget, self).__init__(dashboard, data)
File "C:/../apps\xadmin\views\dashboard.py", line 200, in __init__
if not self.is_valid():
File "C:\Python27\lib\site-packages\django\forms\forms.py", line 183, in is_valid
return self.is_bound and not self.errors
File "C:\Python27\lib\site-packages\django\forms\forms.py", line 175, in errors
self.full_clean()
File "C:\Python27\lib\site-packages\django\forms\forms.py", line 384, in full_clean
self._clean_fields()
File "C:\Python27\lib\site-packages\django\forms\forms.py", line 402, in _clean_fields
value = field.clean(value)
File "C:\Python27\lib\site-packages\django\forms\fields.py", line 160, in clean
value = self.to_python(value)
File "C:/../apps\xadmin\views\dashboard.py", line 301, in to_python
return apps.get_model(app_label, model_name)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 200, in get_model
app_config = self.get_app_config(app_label)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 156, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'app'.
The strange thing is that there is a demo of the app, and I am basing my code off that. This includes the line:
class MainDashboard(object):
widgets = [
[
{
"type": "html",
"title": "Test Widget",
"content": "<h3> Welcome to Xadmin! </h3><p>Join Online Group: <br/>QQ Qun : 282936295</p>"
},
{
"type": "chart",
"model": "app.accessrecord",
"chart": "user_count",
"params":
{
"_p_date__gte": "2013-01-08",
"p": 1,
"_p_date__lt": "2013-01-29"
}
},
Not sure what's going on here. Any pointers would be appreciated.
EDIT
As requested, installed apps:
INSTALLED_APPS = [
'admin_bootstrap',
'survey',
'xadmin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'dashing',
'formtools',
'crispy_forms',
'reversion',
]
Upvotes: 0
Views: 13379
Reputation: 1
You must had run demo_app,so your db.sqlite3 have storaged "widgets" which in class MainDashboard .
class MainDashboard(object):
widgets = [
[
{
"type": "html",
"title": "Test Widget",
"content": "<h3> Welcome to Xadmin! </h3><p>Join Online Group: <br/>QQ Qun : 282936295</p>"
},
{
"type": "chart",
"model": "app.accessrecord",
"chart": "user_count",
"params":
{
"_p_date__gte": "2013-01-08",
"p": 1,
"_p_date__lt": "2013-01-29"
}
},
In this widgets,model used "app.accessrecord",
For me,I only empty "xadmin_userwidget" this table and comment "widgets" ,that have solved my problem
Upvotes: 0
Reputation: 4634
You need to go to your settings.py
file and add xadmin
to the INSTALLED_APPS
list.
See the documentation here: https://docs.djangoproject.com/en/2.0/ref/applications/#for-application-users
Upvotes: 4