diff options
author | Michael Elkins <melkins@tislabs.com> | 2011-03-03 00:01:17 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2011-03-03 00:01:17 +0000 |
commit | 93328022a47ae7ac7a24b48d934ac430d99d8905 (patch) | |
tree | 14dab415f34d95304b86f4d6d9c8b4efaa7f76eb | |
parent | 7a37b6e2bcf3d1ffc41ac9d5b1a6ac1932132030 (diff) |
put django project templates into $top/rpkid/rpki/gui/templates
django templates should be installed as APP/templates/APP/template.html to avoid namespace clashes
svn path=/rpkid/portal-gui/Makefile.in; revision=3709
-rw-r--r-- | rpkid/portal-gui/Makefile.in | 10 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/asn_view.html (renamed from rpkid/rpki/gui/app/templates/asn_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/child_view.html (renamed from rpkid/rpki/gui/app/templates/child_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html (renamed from rpkid/rpki/gui/app/templates/conf_empty.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/conf_list.html (renamed from rpkid/rpki/gui/app/templates/conf_list.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/dashboard.html (renamed from rpkid/rpki/gui/app/templates/dashboard.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/parent_view.html (renamed from rpkid/rpki/gui/app/templates/parent_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html (renamed from rpkid/rpki/gui/app/templates/prefix_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/views.py | 19 | ||||
-rw-r--r-- | rpkid/rpki/gui/templates/base.html (renamed from rpkid/portal-gui/templates/base.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/templates/registration/login.html (renamed from rpkid/portal-gui/templates/registration/login.html) | 2 | ||||
-rw-r--r-- | rpkid/setup.py | 3 |
12 files changed, 14 insertions, 20 deletions
diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in index 58d402cb..6f841570 100644 --- a/rpkid/portal-gui/Makefile.in +++ b/rpkid/portal-gui/Makefile.in @@ -41,7 +41,7 @@ edit = sed \ apache/rpki.conf: $(srcdir)/apache/rpki.conf.in Makefile $(edit) $@.in > $@ -.PHONY: install-perms install-data install install-templates +.PHONY: install-perms install-data install install-perms: chown $(WEBUSER) `dirname $(DATABASE_PATH)` @@ -54,13 +54,7 @@ install-apache: install -m 644 apache/rpki.conf $(INSTDIR)/apache install -m 644 apache/rpki.wsgi $(INSTDIR)/apache -install-templates: - install -d -m 755 $(TEMPLATEDIR) - install -m 644 templates/base.html $(TEMPLATEDIR) - install -d -m 755 $(TEMPLATEDIR)/registration - install -m 644 templates/registration/login.html $(TEMPLATEDIR)/registration - -install-data: $(BUILD) install-apache install-templates +install-data: $(BUILD) install-apache mkdir -p `dirname $(DATABASE_PATH)` $(DJANGO_ADMIN) syncdb --settings rpki.gui.settings diff --git a/rpkid/rpki/gui/app/templates/asn_view.html b/rpkid/rpki/gui/app/templates/rpkigui/asn_view.html index 4417c576..4417c576 100644 --- a/rpkid/rpki/gui/app/templates/asn_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/asn_view.html diff --git a/rpkid/rpki/gui/app/templates/child_view.html b/rpkid/rpki/gui/app/templates/rpkigui/child_view.html index 9bcdf948..9bcdf948 100644 --- a/rpkid/rpki/gui/app/templates/child_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/child_view.html diff --git a/rpkid/rpki/gui/app/templates/conf_empty.html b/rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html index 0ef9366c..0ef9366c 100644 --- a/rpkid/rpki/gui/app/templates/conf_empty.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html diff --git a/rpkid/rpki/gui/app/templates/conf_list.html b/rpkid/rpki/gui/app/templates/rpkigui/conf_list.html index 4bb18114..4bb18114 100644 --- a/rpkid/rpki/gui/app/templates/conf_list.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/conf_list.html diff --git a/rpkid/rpki/gui/app/templates/dashboard.html b/rpkid/rpki/gui/app/templates/rpkigui/dashboard.html index dea03c31..dea03c31 100644 --- a/rpkid/rpki/gui/app/templates/dashboard.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/dashboard.html diff --git a/rpkid/rpki/gui/app/templates/parent_view.html b/rpkid/rpki/gui/app/templates/rpkigui/parent_view.html index 13a9d848..13a9d848 100644 --- a/rpkid/rpki/gui/app/templates/parent_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/parent_view.html diff --git a/rpkid/rpki/gui/app/templates/prefix_view.html b/rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html index 78e9958a..78e9958a 100644 --- a/rpkid/rpki/gui/app/templates/prefix_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py index e1048e2a..ad5f87a6 100644 --- a/rpkid/rpki/gui/app/views.py +++ b/rpkid/rpki/gui/app/views.py @@ -65,7 +65,7 @@ def handle_required(f): if conf.count() == 1: handle = conf[0] elif conf.count() == 0: - return render('myrpki/conf_empty.html', {}, request) + return render('rpkigui/conf_empty.html', {}, request) #return http.HttpResponseRedirect('/myrpki/conf/add') else: # Should reverse the view for this instead of hardcoding @@ -81,7 +81,7 @@ def render(template, context, request): context_instance=RequestContext(request)) @handle_required -def dashboard(request): +def dashboard(request, template_name='rpkigui/dashboard.html'): '''The user's dashboard.''' handle = request.session[ 'handle' ] # ... pick out data for the dashboard and return it @@ -109,8 +109,7 @@ def dashboard(request): asns.sort(key=lambda x: x.range.min) prefixes.sort(key=lambda x: x.range.min) - return render('myrpki/dashboard.html', { 'conf': handle, 'asns': asns, - 'ars': prefixes }, request) + return render(template_name, { 'conf': handle, 'asns': asns, 'ars': prefixes }, request) @login_required def conf_list(request): @@ -120,7 +119,7 @@ def conf_list(request): else: queryset = models.Conf.objects.filter(owner=request.user) return object_list(request, queryset, - template_name='myrpki/conf_list.html', template_object_name='conf', extra_context={ 'select_url' : reverse(conf_select) }) + template_name='rpkigui/conf_list.html', template_object_name='conf', extra_context={ 'select_url' : reverse(conf_select) }) @login_required def conf_select(request): @@ -161,7 +160,7 @@ def parent_view(request, parent_handle): """Detail view for a particular parent.""" handle = request.session['handle'] parent = get_object_or_404(handle.parents, handle__exact=parent_handle) - return render('myrpki/parent_view.html', { 'parent': parent }, request) + return render('rpkigui/parent_view.html', { 'parent': parent }, request) def get_parents_or_404(handle, obj): '''Return the Parent object(s) that the given address range derives @@ -181,7 +180,7 @@ def asn_view(request, pk): roas = handle.roas.filter(asn=obj.lo) # roas which contain this asn unallocated = AllocationTree.AllocationTreeAS(obj).unallocated() - return render('myrpki/asn_view.html', + return render('rpkigui/asn_view.html', { 'asn': obj, 'parent': parent_set, 'roas': roas, 'unallocated' : unallocated }, request) @@ -191,7 +190,7 @@ def child_view(request, child_handle): handle = request.session['handle'] child = get_object_or_404(handle.children, handle__exact=child_handle) - return render('myrpki/child_view.html', { 'child': child }, request) + return render('rpkigui/child_view.html', { 'child': child }, request) class PrefixView(object): '''Extensible view for address ranges/prefixes. This view can be @@ -218,7 +217,7 @@ class PrefixView(object): u = AllocationTree.AllocationTreeIP.from_prefix(self.obj).unallocated() - return render('myrpki/prefix_view.html', + return render('rpkigui/prefix_view.html', { 'addr': self.obj, 'parent': self.parent_set, 'unallocated': u, 'form': self.form }, self.request) @@ -369,7 +368,7 @@ def asn_allocate_view(request, pk): form = forms.PrefixAllocateForm(obj.allocated.pk if obj.allocated else None, handle.children.all()) - return render('myrpki/asn_view.html', { 'form': form, + return render('rpkigui/asn_view.html', { 'form': form, 'asn': obj, 'form': form, 'parent': parent_set }, request) # this is similar to handle_required, except that the handle is given in URL diff --git a/rpkid/portal-gui/templates/base.html b/rpkid/rpki/gui/templates/base.html index a096cdca..a096cdca 100644 --- a/rpkid/portal-gui/templates/base.html +++ b/rpkid/rpki/gui/templates/base.html diff --git a/rpkid/portal-gui/templates/registration/login.html b/rpkid/rpki/gui/templates/registration/login.html index 86b5392a..f99e9a25 100644 --- a/rpkid/portal-gui/templates/registration/login.html +++ b/rpkid/rpki/gui/templates/registration/login.html @@ -6,7 +6,7 @@ <p>Your username and password didn't match. Please try again.</p> {% endif %} -<form method="post" action="{% url django.contrib.auth.views.login %}"> +<form method="post" action="{% url django.contrib.auth.views.login %}">{% csrf_token %} <table> <tr> <td>{{ form.username.label_tag }}</td> diff --git a/rpkid/setup.py b/rpkid/setup.py index 6b397e45..4efe523b 100644 --- a/rpkid/setup.py +++ b/rpkid/setup.py @@ -48,7 +48,8 @@ setup(name = "rpkitoolkit", url = "http://www.rpki.net/", packages = ["rpki", "rpki.POW", "rpki.gui", "rpki.gui.app" ], ext_modules = [pow], - package_data = { 'rpki.gui.app' : [ 'templates/*.html' ] }, + package_data = {'rpki.gui' : ['templates/*.html', 'templates/registration/*.html'], + 'rpki.gui.app' : ['templates/rpkigui/*.html']}, # bdist_rpm seems to get confused by relative names for scripts, # so we have to prefix the source name of anything here with the |