1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
Index: django-tables/django_tables2/columns/base.py
===================================================================
--- django-tables.orig/django_tables2/columns/base.py 2014-02-02 20:07:17.000000000 +1100
+++ django-tables/django_tables2/columns/base.py 2014-10-17 10:03:42.751724866 +1100
@@ -1,7 +1,7 @@
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from django.db.models.fields import FieldDoesNotExist
-from django.utils.datastructures import SortedDict
+from collections import OrderedDict
from django.utils.safestring import SafeData
from django_tables2.templatetags.django_tables2 import title
from django_tables2.utils import A, AttributeDict, OrderBy, OrderByTuple
@@ -518,7 +518,7 @@
A `BoundColumns` object is a container for holding `BoundColumn` objects.
It provides methods that make accessing columns easier than if they were
stored in a `list` or `dict`. `Columns` has a similar API to a `dict` (it
- actually uses a `~django.utils.datastructures.SortedDict` interally).
+ actually uses a `~collections.OrderedDict` interally).
At the moment you'll only come across this class when you access a
`.Table.columns` property.
@@ -528,7 +528,7 @@
"""
def __init__(self, table):
self.table = table
- self.columns = SortedDict()
+ self.columns = OrderedDict()
for name, column in six.iteritems(table.base_columns):
self.columns[name] = bc = BoundColumn(table, column, name)
bc.render = getattr(table, 'render_' + name, column.render)
Index: django-tables/django_tables2/tables.py
===================================================================
--- django-tables.orig/django_tables2/tables.py 2014-02-02 20:07:17.000000000 +1100
+++ django-tables/django_tables2/tables.py 2014-10-17 10:03:12.888413668 +1100
@@ -8,7 +8,7 @@
import copy
from django.core.paginator import Paginator
from django.db.models.fields import FieldDoesNotExist
-from django.utils.datastructures import SortedDict
+from collections import OrderedDict
from django.template import RequestContext
from django.template.loader import get_template
import six
@@ -168,10 +168,10 @@
if hasattr(base, "base_columns"):
parent_columns = list(base.base_columns.items()) + parent_columns
# Start with the parent columns
- attrs["base_columns"] = SortedDict(parent_columns)
+ attrs["base_columns"] = OrderedDict(parent_columns)
# Possibly add some generated columns based on a model
if opts.model:
- extra = SortedDict()
+ extra = OrderedDict()
# honor Table.Meta.fields, fallback to model._meta.fields
if opts.fields:
# Each item in opts.fields is the name of a model field or a
@@ -190,7 +190,7 @@
attrs["base_columns"].update(extra)
# Explicit columns override both parent and generated columns
- attrs["base_columns"].update(SortedDict(cols))
+ attrs["base_columns"].update(OrderedDict(cols))
# Apply any explicit exclude setting
for exclusion in opts.exclude:
if exclusion in attrs["base_columns"]:
@@ -200,7 +200,7 @@
opts.sequence.expand(attrs["base_columns"].keys())
# Table's sequence defaults to sequence declared in Meta
#attrs['_sequence'] = opts.sequence
- attrs["base_columns"] = SortedDict(((x, attrs["base_columns"][x]) for x in opts.sequence))
+ attrs["base_columns"] = OrderedDict(((x, attrs["base_columns"][x]) for x in opts.sequence))
# set localize on columns
for col_name in attrs["base_columns"].keys():
Index: django-tables/django_tables2/templatetags/django_tables2.py
===================================================================
--- django-tables.orig/django_tables2/templatetags/django_tables2.py 2014-02-02 20:07:17.000000000 +1100
+++ django-tables/django_tables2/templatetags/django_tables2.py 2014-10-17 10:03:12.888413668 +1100
@@ -5,7 +5,7 @@
from django.template import TemplateSyntaxError, Variable, Node
from django.template.loader import get_template, select_template
from django.template.defaultfilters import stringfilter, title as old_title
-from django.utils.datastructures import SortedDict
+from collections import OrderedDict
from django.utils.http import urlencode
from django.utils.html import escape
from django.utils.safestring import mark_safe
@@ -35,7 +35,7 @@
"""
if not bits:
return {}
- kwargs = SortedDict()
+ kwargs = OrderedDict()
while bits:
match = kwarg_re.match(bits[0])
if not match or not match.group(1):
|