From 802913d5e4d40ee17054415bded02981055b651d Mon Sep 17 00:00:00 2001 From: Anton D. Kachalov Date: Fri, 26 Sep 2014 16:07:46 +0400 Subject: [templates/rest_framework/base.html] Separate `object-form' and `generic-content-form' IDs for POST and PUT forms Signed-off-by: Anton D. Kachalov --- rest_framework/templates/rest_framework/base.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'rest_framework') diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index a84ccf26..3628daa0 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -142,16 +142,16 @@ {% if post_form %} {% endif %}
{% if post_form %} -
+
{% with form=post_form %}
@@ -166,7 +166,7 @@ {% endwith %}
{% endif %} -
+
{% with form=raw_data_post_form %}
@@ -188,16 +188,16 @@ {% if put_form %} {% endif %}
{% if put_form %} -
+
@@ -211,7 +211,7 @@
{% endif %} -
+
{% with form=raw_data_put_or_patch_form %}
-- cgit v1.2.3 From 12b677039d5485afa7bc913a6f56c4b107fbbe3f Mon Sep 17 00:00:00 2001 From: Erik Wickstrom Date: Sun, 19 Oct 2014 21:03:33 -0700 Subject: Maintain order of views on router for api root view. --- rest_framework/routers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rest_framework') diff --git a/rest_framework/routers.py b/rest_framework/routers.py index f2d06211..9937566d 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -16,7 +16,7 @@ For example, you might have a `urls.py` that looks something like this: from __future__ import unicode_literals import itertools -from collections import namedtuple +from collections import namedtuple, OrderedDict from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import NoReverseMatch @@ -277,7 +277,7 @@ class DefaultRouter(SimpleRouter): """ Return a view to use as the API root. """ - api_root_dict = {} + api_root_dict = OrderedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) @@ -286,7 +286,7 @@ class DefaultRouter(SimpleRouter): _ignore_model_permissions = True def get(self, request, *args, **kwargs): - ret = {} + ret = OrderedDict() for key, url_name in api_root_dict.items(): try: ret[key] = reverse( -- cgit v1.2.3 From 674855a114cca8afbcd7a9927170d0d420aea819 Mon Sep 17 00:00:00 2001 From: Erik Wickstrom Date: Mon, 20 Oct 2014 08:47:45 -0700 Subject: Used Django utils SortedDict instead of stdlib's OrderedDict for wider compatability. --- rest_framework/routers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rest_framework') diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 9937566d..169e6e8b 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -16,10 +16,11 @@ For example, you might have a `urls.py` that looks something like this: from __future__ import unicode_literals import itertools -from collections import namedtuple, OrderedDict +from collections import namedtuple from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import NoReverseMatch +from django.utils.datastructures import SortedDict from rest_framework import views from rest_framework.response import Response from rest_framework.reverse import reverse @@ -277,7 +278,7 @@ class DefaultRouter(SimpleRouter): """ Return a view to use as the API root. """ - api_root_dict = OrderedDict() + api_root_dict = SortedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) @@ -286,7 +287,7 @@ class DefaultRouter(SimpleRouter): _ignore_model_permissions = True def get(self, request, *args, **kwargs): - ret = OrderedDict() + ret = SortedDict() for key, url_name in api_root_dict.items(): try: ret[key] = reverse( -- cgit v1.2.3