From dbac5fe4bcd374d8446a2acf30ac46201a4a1648 Mon Sep 17 00:00:00 2001 From: Guilherme Gondim Date: Tue, 26 Aug 2008 19:28:56 +0000 Subject: [PATCH] =?UTF-8?q?In=C3=ADcio=20de=20personaliza=C3=A7=C3=A3o=20d?= =?UTF-8?q?e=20templates=20do=20admin.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/sites.py | 9 +++++++ sigi/templates/admin/base_site.html | 39 +++++++++++++++++++++++++++++ sigi/templates/index.html | 5 ++++ sigi/templates/login.html | 6 +++++ sigi/urls.py | 27 +++++++++----------- 5 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 sigi/sites.py create mode 100644 sigi/templates/admin/base_site.html create mode 100644 sigi/templates/index.html create mode 100644 sigi/templates/login.html diff --git a/sigi/sites.py b/sigi/sites.py new file mode 100644 index 0000000..82de2ef --- /dev/null +++ b/sigi/sites.py @@ -0,0 +1,9 @@ +from django.contrib.admin.sites import AdminSite +from sigi.apps.casas.admin import CasaLegislativa, CasaLegislativaAdmin + +class DefaultSite(AdminSite): + index_template = 'index.html' + login_template = 'login.html' + +default = DefaultSite() +default.register(CasaLegislativa, CasaLegislativaAdmin) diff --git a/sigi/templates/admin/base_site.html b/sigi/templates/admin/base_site.html new file mode 100644 index 0000000..e335a6d --- /dev/null +++ b/sigi/templates/admin/base_site.html @@ -0,0 +1,39 @@ +{% extends "admin/base.html" %} + +{% block title %}{{ title }} | SIGI{% endblock %} + +{% block extrastyle %} + +{% endblock %} + +{% block branding %} +

Sistema de Informações Gerenciais do Interlegis

+{% endblock %} + +{% block nav-global %} + +{% endblock %} diff --git a/sigi/templates/index.html b/sigi/templates/index.html new file mode 100644 index 0000000..c17bdcc --- /dev/null +++ b/sigi/templates/index.html @@ -0,0 +1,5 @@ +{% extends "admin/index.html" %} + +{% block title %}Dashboard | SIGI{% endblock %} + +{% block content_title %}

Dashboard

{% endblock %} diff --git a/sigi/templates/login.html b/sigi/templates/login.html new file mode 100644 index 0000000..f4dcd85 --- /dev/null +++ b/sigi/templates/login.html @@ -0,0 +1,6 @@ +{% extends "admin/login.html" %} +{% load i18n %} + +{% block branding %} +

SIGI

+{% endblock %} diff --git a/sigi/urls.py b/sigi/urls.py index e412cf0..81f9ba3 100644 --- a/sigi/urls.py +++ b/sigi/urls.py @@ -1,32 +1,29 @@ from django.conf import settings from django.conf.urls.defaults import * -from django.contrib import admin from django.contrib import databrowse from django.db.models import get_models +from sigi import sites -admin.autodiscover() map(databrowse.site.register, get_models()) urlpatterns = patterns( '', - (r'^doc/', include('django.contrib.admindocs.urls')), - (r'^(.*)', admin.site.root), - # databrowse (r'^databrowse/(.*)', databrowse.site.root), # bug report #(r'^bug_report/$', 'sigi.views.bug_report'), -) -if settings.MAINTENANCE: - urlpatterns = patterns('', - (r'.*', 'sigi.views.service_unavailable') - ) + urlpatterns + # admin docs + (r'^doc/', include('django.contrib.admindocs.urls')), + + # automatic interface based on admin + (r'^(.*)', sites.default.root), +) -if settings.DEBUG: - urlpatterns += patterns( +if not settings.DEBUG: + urlpatterns = patterns( '', # static files @@ -34,11 +31,11 @@ if settings.DEBUG: {'document_root': settings.MEDIA_ROOT}), (r'^404/$', 'django.views.generic.simple.direct_to_template', - {'template': '404.html'}), + {'template': 'admin/404.html'}), (r'^500/$', 'django.views.generic.simple.direct_to_template', - {'template': '500.html'}), + {'template': 'admin/500.html'}), (r'^503/$', 'django.views.generic.simple.direct_to_template', {'template': '503.html'}), - ) + ) + urlpatterns