Skip to content

Commit

Permalink
admin dashboard and filebrowser + more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesisdesign committed Sep 5, 2013
1 parent 9df3292 commit a57bdcf
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 20 deletions.
94 changes: 94 additions & 0 deletions nodeshot/dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"""
This file was generated with the customdashboard management command and
contains the class for the main dashboard.
To activate your index dashboard add the following to your settings.py::
GRAPPELLI_INDEX_DASHBOARD = 'nodeshot.dashboard.CustomIndexDashboard'
"""

from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.conf import settings

from grappelli.dashboard import modules, Dashboard
from grappelli.dashboard.utils import get_admin_site_name

USER_APPS = ['django.contrib.*']
if 'nodeshot.community.profiles' in settings.INSTALLED_APPS:
USER_APPS.append('nodeshot.community.profiles.*')


class NodeshotDashboard(Dashboard):
"""
Custom index dashboard for www.
"""

def init_with_context(self, context):
site_name = get_admin_site_name(context)

self.children.append(modules.AppList(
_('Nodeshot Core'),
collapsible=True,
column=1,
models=('nodeshot.core.*',),
))

self.children.append(modules.AppList(
_('Nodeshot Networking'),
collapsible=True,
column=1,
models=('nodeshot.networking.*',),
))

self.children.append(modules.AppList(
_('Nodeshot Community'),
collapsible=True,
column=1,
models=('nodeshot.community.*',),
))

self.children.append(modules.AppList(
_('Administration'),
collapsible=True,
column=2,
models=USER_APPS,
))

# append a recent actions module
self.children.append(modules.RecentActions(
_('Recent Actions'),
limit=5,
collapsible=False,
column=2,
))

# append another link list module for "support".
self.children.append(modules.LinkList(
_('Media Management'),
column=3,
children=[
{
'title': _('FileBrowser'),
'url': '/admin/filebrowser/browse/',
'external': False,
},
]
))

# append another link list module for "support".
self.children.append(modules.LinkList(
_('Support'),
column=3,
children=[
{
'title': _('Django Documentation'),
'url': 'http://docs.djangoproject.com/',
'external': True,
},
{
'title': _('Grappelli Documentation'),
'url': 'http://packages.python.org/django-grappelli/',
'external': True,
},
]
))
6 changes: 5 additions & 1 deletion nodeshot/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
from django.conf import settings
from django.contrib import admin

from filebrowser.sites import site

admin.autodiscover()


urlpatterns = patterns('',)
urlpatterns = patterns('',
url(r'^admin/filebrowser/', include(site.urls)),
)


if 'social_auth' in settings.INSTALLED_APPS:
Expand Down
Empty file.
26 changes: 18 additions & 8 deletions projects/georate/georate/settings.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,24 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'georate.wsgi.application'

import nodeshot

TEMPLATE_DIRS = (
'%s/core/mailing/templates' % os.path.dirname(os.path.realpath(nodeshot.__file__)),
'%s/core/zones/templates' % os.path.dirname(os.path.realpath(nodeshot.__file__))
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.request",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages"
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -136,7 +144,9 @@
'django.contrib.gis',

# adming
'grappelli.dashboard',
'grappelli',
'filebrowser',
'django.contrib.admin',

# --- background jobs --- #
Expand Down Expand Up @@ -230,15 +240,15 @@
# 'level': 'DEBUG',
# 'propagate': True,
#},
'nodeshot.core.mailing': {
'nodeshot.community.mailing': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
'nodeshot.core.zones': {
'nodeshot.core.layers': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
'nodeshot.contrib.profiles': {
'nodeshot.community.profiles': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
Expand Down Expand Up @@ -360,8 +370,7 @@
},
# default values for the application or new database objects
'DEFAULTS': {
# default map zoom level when creating new zones
'MAP_ZOOM': 12,
'MAP_ZOOM': 12, # default map zoom level when creating new layers
'TIME_ZONE': 'GMT+1', # TODO: check if it can be determined by django
'NODE_PUBLISHED': True,
'LAYER_ZOOM': 12,
Expand Down Expand Up @@ -437,6 +446,7 @@

if 'grappelli' in INSTALLED_APPS:
GRAPPELLI_ADMIN_TITLE = 'Nodeshot Admin'
GRAPPELLI_INDEX_DASHBOARD = 'nodeshot.dashboard.NodeshotDashboard'

# ------ DEBUG TOOLBAR ------ #

Expand Down
Empty file.
29 changes: 20 additions & 9 deletions projects/ninux/ninux/settings.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,24 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'ninux.wsgi.application'

#import nodeshot

TEMPLATE_DIRS = (
#'%s/core/mailing/templates' % os.path.dirname(os.path.realpath(nodeshot.__file__)),
#'%s/core/layers/templates' % os.path.dirname(os.path.realpath(nodeshot.__file__))
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.request",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages"
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -146,8 +154,10 @@
'django.contrib.staticfiles',
'django.contrib.gis',

# adming
# admin site
'grappelli.dashboard',
'grappelli',
'filebrowser',
'django.contrib.admin',

# --- background jobs --- #
Expand All @@ -174,8 +184,8 @@
'nodeshot.networking.links',
'nodeshot.networking.services',
'nodeshot.networking.hardware',
'nodeshot.networking.planning',
'nodeshot.networking.monitor',
#'nodeshot.networking.planning',
#'nodeshot.networking.monitor',
'nodeshot.interface',

# import data from old nodeshot version 0.9
Expand Down Expand Up @@ -254,15 +264,15 @@
# 'level': 'DEBUG',
# 'propagate': True,
#},
'nodeshot.core.mailing': {
'nodeshot.community.mailing': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
'nodeshot.core.zones': {
'nodeshot.core.layers': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
'nodeshot.contrib.profiles': {
'nodeshot.community.profiles': {
'handlers': ['logfile'],
'level': 'DEBUG',
},
Expand Down Expand Up @@ -464,6 +474,7 @@

if 'grappelli' in INSTALLED_APPS:
GRAPPELLI_ADMIN_TITLE = 'Nodeshot Admin'
GRAPPELLI_INDEX_DASHBOARD = 'nodeshot.dashboard.NodeshotDashboard'

# ------ DEBUG TOOLBAR ------ #

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# run pip install -r requirements

psycopg2
Django==1.5.1
Django==1.5.2

# python libraries
PIL
Expand All @@ -18,7 +18,8 @@ wsgiref
requests

# better admin
django-grappelli==2.4.5
django-grappelli==2.4.6
django-filebrowser==3.5.2

# utils
django-extensions
Expand Down

0 comments on commit a57bdcf

Please sign in to comment.