diff --git a/ietf/help/__init__.py b/ietf/help/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ietf/help/models.py b/ietf/help/models.py new file mode 100644 index 000000000..b1cfe267e --- /dev/null +++ b/ietf/help/models.py @@ -0,0 +1 @@ +# Empty \ No newline at end of file diff --git a/ietf/help/tests.py b/ietf/help/tests.py new file mode 100644 index 000000000..2247054b3 --- /dev/null +++ b/ietf/help/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/ietf/help/urls.py b/ietf/help/urls.py new file mode 100644 index 000000000..6bbd01b27 --- /dev/null +++ b/ietf/help/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls.defaults import patterns, url + +urlpatterns = patterns('', + url(r'^state/(?P[-\w]+)/(?P[-\w]+)/?$', 'ietf.help.views.state'), + url(r'^state/(?P[-\w]+)/?$', 'ietf.help.views.state'), +) + diff --git a/ietf/help/views.py b/ietf/help/views.py new file mode 100644 index 000000000..3eeae97f5 --- /dev/null +++ b/ietf/help/views.py @@ -0,0 +1,18 @@ +# Copyright The IETF Trust 2007, All Rights Reserved + +from django.template import RequestContext +from django.shortcuts import get_object_or_404, render_to_response + +import debug + +from doc.models import State, StateType + + +def state(request, doc, type=None): + slug = "%s-%s" % (doc,type) if type else doc + debug.show('slug') + statetype = get_object_or_404(StateType, slug=slug) + states = State.objects.filter(type=statetype).order_by('order') + return render_to_response('help/states.html', {"doc": doc, "type": statetype, "states":states}, + context_instance=RequestContext(request)) + diff --git a/ietf/templates/help/states.html b/ietf/templates/help/states.html new file mode 100644 index 000000000..8bad73115 --- /dev/null +++ b/ietf/templates/help/states.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{# Copyright The IETF Trust 2007, All Rights Reserved #} + +{% block title %} {{type.label|cut:"state"|cut:"State"}} Statess{% endblock %} + +{% block content %} + +

{{type.label|cut:"state"|cut:"State"}} States

+ + + + + + + + + +{% for state in states %} + + + + + +{% endfor %} +
StateDescriptionNext State
{{ state.name }}{{ state.desc|safe }}
    {% for s in state.next_states.all %}
  • {{ s.name }}
  • {%endfor%}
+ + +{% endblock %} diff --git a/ietf/urls.py b/ietf/urls.py index a0f17452c..6ed1d7baf 100644 --- a/ietf/urls.py +++ b/ietf/urls.py @@ -69,6 +69,7 @@ urlpatterns = patterns('', (r'^(?Ppublic)/', include('ietf.redirects.urls')), (r'^wg/', include('ietf.wginfo.urls')), (r'^sync/', include('ietf.sync.urls')), + (r'^help/', include('ietf.help.urls')), # Google webmaster tools verification url (r'^googlea30ad1dacffb5e5b.html', 'django.views.generic.simple.direct_to_template', { 'template': 'googlea30ad1dacffb5e5b.html' }),