Browse Source

Início de personalização de templates do admin.

0.2
Guilherme Gondim 17 years ago
parent
commit
dbac5fe4bc
  1. 9
      sigi/sites.py
  2. 39
      sigi/templates/admin/base_site.html
  3. 5
      sigi/templates/index.html
  4. 6
      sigi/templates/login.html
  5. 27
      sigi/urls.py

9
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)

39
sigi/templates/admin/base_site.html

@ -0,0 +1,39 @@
{% extends "admin/base.html" %}
{% block title %}{{ title }} | SIGI{% endblock %}
{% block extrastyle %}
<style type="text/css">
<!--
#nav-global {
background-color: #292929;
}
#nav-global ul {
margin: 0;
padding: 1px 10px;
}
#nav-global li {
display: inline;
list-style-type: none;
}
-->
</style>
{% endblock %}
{% block branding %}
<h1 id="site-name">Sistema de Informações Gerenciais do Interlegis</h1>
{% endblock %}
{% block nav-global %}
<!--div id="nav-global">
<ul>
<li>Casas Legislativas</li>
<li>Parlamentares</li>
<li>Mesas Legislativas</li>
<li>Convênios</li>
<li>Inventário</li>
</ul>
</div-->
{% endblock %}

5
sigi/templates/index.html

@ -0,0 +1,5 @@
{% extends "admin/index.html" %}
{% block title %}Dashboard | SIGI{% endblock %}
{% block content_title %}<h1>Dashboard</h1>{% endblock %}

6
sigi/templates/login.html

@ -0,0 +1,6 @@
{% extends "admin/login.html" %}
{% load i18n %}
{% block branding %}
<h1 id="site-name">SIGI</h1>
{% endblock %}

27
sigi/urls.py

@ -1,32 +1,29 @@
from django.conf import settings from django.conf import settings
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from django.contrib import admin
from django.contrib import databrowse from django.contrib import databrowse
from django.db.models import get_models from django.db.models import get_models
from sigi import sites
admin.autodiscover()
map(databrowse.site.register, get_models()) map(databrowse.site.register, get_models())
urlpatterns = patterns( urlpatterns = patterns(
'', '',
(r'^doc/', include('django.contrib.admindocs.urls')),
(r'^(.*)', admin.site.root),
# databrowse # databrowse
(r'^databrowse/(.*)', databrowse.site.root), (r'^databrowse/(.*)', databrowse.site.root),
# bug report # bug report
#(r'^bug_report/$', 'sigi.views.bug_report'), #(r'^bug_report/$', 'sigi.views.bug_report'),
)
if settings.MAINTENANCE: # admin docs
urlpatterns = patterns('', (r'^doc/', include('django.contrib.admindocs.urls')),
(r'.*', 'sigi.views.service_unavailable')
) + urlpatterns # automatic interface based on admin
(r'^(.*)', sites.default.root),
)
if settings.DEBUG: if not settings.DEBUG:
urlpatterns += patterns( urlpatterns = patterns(
'', '',
# static files # static files
@ -34,11 +31,11 @@ if settings.DEBUG:
{'document_root': settings.MEDIA_ROOT}), {'document_root': settings.MEDIA_ROOT}),
(r'^404/$', 'django.views.generic.simple.direct_to_template', (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', (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', (r'^503/$', 'django.views.generic.simple.direct_to_template',
{'template': '503.html'}), {'template': '503.html'}),
) ) + urlpatterns

Loading…
Cancel
Save