diff options
author | Rene Martin <rene@minicroso.(none)> | 2010-04-04 17:29:25 +0100 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2010-04-08 09:03:38 -0500 |
commit | 66f08b0a6dd519009c6d2094421498e4d446114e (patch) | |
tree | ba761ca72aa6b365dbc4094e2c13f88ff92c9910 /src/lib/Server/Hostbase/hostbase | |
parent | abdf325e1564a84b685c604ba29b9216d2430d3a (diff) | |
download | bcfg2-66f08b0a6dd519009c6d2094421498e4d446114e.tar.gz bcfg2-66f08b0a6dd519009c6d2094421498e4d446114e.tar.bz2 bcfg2-66f08b0a6dd519009c6d2094421498e4d446114e.zip |
Initial port from Django 0.95 to Django 1.1.
There are lots of things to change, from new admin interface to all the forms.
I'm already changed some views to generic ones.
All the models are "fixed" to fit in 1.1 specification.
Some refactor in url's, named url's added too
Diffstat (limited to 'src/lib/Server/Hostbase/hostbase')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/admin.py | 15 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/urls.py | 54 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/admin.py b/src/lib/Server/Hostbase/hostbase/admin.py new file mode 100644 index 000000000..70a2233cc --- /dev/null +++ b/src/lib/Server/Hostbase/hostbase/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin + +from models import Host, Interface, IP, MX, Name, CName, Nameserver, ZoneAddress, Zone, Log, ZoneLog + +admin.site.register(Host) +admin.site.register(Interface) +admin.site.register(IP) +admin.site.register(MX) +admin.site.register(Name) +admin.site.register(CName) +admin.site.register(Nameserver) +admin.site.register(ZoneAddress) +admin.site.register(Zone) +admin.site.register(Log) +admin.site.register(ZoneLog) diff --git a/src/lib/Server/Hostbase/hostbase/urls.py b/src/lib/Server/Hostbase/hostbase/urls.py new file mode 100644 index 000000000..0e4588446 --- /dev/null +++ b/src/lib/Server/Hostbase/hostbase/urls.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +from django.conf.urls.defaults import * +from django.core.urlresolvers import reverse + +from models import Host, Zone + +host_detail_dict = { + 'queryset':Host.objects.all(), + 'template_name':'host.html', + 'template_object_name':'host', +} + +zone_new_dict = { + 'model':Zone, + 'template_name':'zonenew.html', + 'post_save_redirect':'/hostbase/zones', +} +zones_list_dict = { + 'queryset':Zone.objects.all(), + 'template_name':'zones.html', + 'template_object_name':'zone', +} +zone_detail_dict = { + 'queryset':Zone.objects.all(), + 'template_name':'zoneview.html', + 'template_object_name':'zone', +} + +urlpatterns = patterns('django.views.generic.list_detail', + (r'^(?P<object_id>\d+)/$', 'object_detail', host_detail_dict, 'host_detail'), + (r'^zones/$', 'object_list', zones_list_dict, 'zone_list'), + (r'^zones/(?P<object_id>\d+)/$', 'object_detail', zone_detail_dict, 'zone_detail'), +) + +urlpatterns += patterns('django.views.generic.create_update', + (r'^zones/new/$', 'create_object', zone_new_dict, 'zone_new'), + (r'^zones/(?P<object_id>\d+)/edit', 'update_object', zone_new_dict, 'zone_edit'), +) + +urlpatterns += patterns('Bcfg2.Server.Hostbase.hostbase.views', + (r'^$', 'search'), + (r'^(?P<host_id>\d+)/edit', 'edit'), + (r'^(?P<host_id>\d+)/remove', 'remove'), + (r'^(?P<host_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/confirm', 'confirm'), + (r'^(?P<host_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/(?P<name_id>\d+)/confirm', 'confirm'), + (r'^(?P<host_id>\d+)/dns/edit', 'dnsedit'), + (r'^(?P<host_id>\d+)/dns', 'dns'), + (r'^(?P<host_id>\d+)/logs/(?P<log_id>\d+)', 'printlog'), + (r'^(?P<host_id>\d+)/logs', 'logs'), + (r'^new', 'new'), + (r'^(?P<host_id>\d+)/copy', 'copy'), +# (r'^hostinfo', 'hostinfo'), + (r'^zones/(?P<zone_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/confirm', 'confirm'), + ) |