From 42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a Mon Sep 17 00:00:00 2001 From: tom christie tom@tomchristie.com Date: Sun, 30 Jan 2011 18:30:39 +0000 Subject: Rename to django-rest-framework, get simpleexample working --- djangorestframework/templates/emitter.html | 108 +++++++++++++++++++++++++++++ djangorestframework/templates/emitter.txt | 8 +++ 2 files changed, 116 insertions(+) create mode 100644 djangorestframework/templates/emitter.html create mode 100644 djangorestframework/templates/emitter.txt (limited to 'djangorestframework/templates') diff --git a/djangorestframework/templates/emitter.html b/djangorestframework/templates/emitter.html new file mode 100644 index 00000000..d21350cd --- /dev/null +++ b/djangorestframework/templates/emitter.html @@ -0,0 +1,108 @@ +{% load urlize_quoted_links %}{% load add_query_param %} + + + + + API - {{ resource.name }} + + +
+ Django REST framework + {% if user.is_active %}Welcome, {{ user }}.{% if logout_url %} Log out{% endif %}{% else %}Not logged in {% if login_url %}Log in{% endif %}{% endif %} +
+
+

{{ resource.name }}

+

{{ resource.description|linebreaksbr }}

+
{{ response.status }} {{ response.status_text }}{% autoescape off %}
+{% for key, val in response.headers.items %}{{ key }}: {{ val|urlize_quoted_links }}
+{% endfor %}
+{{ content|urlize_quoted_links }}
{% endautoescape %} + + {% if 'GET' in resource.allowed_methods %} +
+ GET + +
+
+ {% endif %} + + {% comment %} *** Only display the POST/PUT/DELETE forms if we have a bound form, and if method *** + *** tunneling via POST forms is enabled. *** + *** (We could display only the POST form if method tunneling is disabled, but I think *** + *** the user experience would be confusing, so we simply turn all forms off. *** {% endcomment %} + + {% if resource.METHOD_PARAM and form %} + {% if 'POST' in resource.allowed_methods %} +
+
+ {% csrf_token %} + {{ form.non_field_errors }} + {% for field in form %} +
+ {{ field.label_tag }}: + {{ field }} + {{ field.help_text }} + {{ field.errors }} +
+ {% endfor %} +
+ +
+
+ {% endif %} + + {% if 'PUT' in resource.allowed_methods %} +
+
+ + {% csrf_token %} + {{ form.non_field_errors }} + {% for field in form %} +
+ {{ field.label_tag }}: + {{ field }} + {{ field.help_text }} + {{ field.errors }} +
+ {% endfor %} +
+ +
+
+ {% endif %} + + {% if 'DELETE' in resource.allowed_methods %} +
+
+ {% csrf_token %} + + +
+
+ {% endif %} + {% endif %} +
+ + \ No newline at end of file diff --git a/djangorestframework/templates/emitter.txt b/djangorestframework/templates/emitter.txt new file mode 100644 index 00000000..1cc7d1d7 --- /dev/null +++ b/djangorestframework/templates/emitter.txt @@ -0,0 +1,8 @@ +{{ resource.name }} + +{{ resource.description }} + +{% autoescape off %}HTTP/1.0 {{ response.status }} {{ response.status_text }} +{% for key, val in response.headers.items %}{{ key }}: {{ val }} +{% endfor %} +{{ content }}{% endautoescape %} -- cgit v1.2.3