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