mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
boulder-oracle-sprint: Merged to [5318]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
12b5df62dd
commit
179a8c44bb
@ -72,6 +72,7 @@ def result_headers(cl):
|
||||
for i, field_name in enumerate(lookup_opts.admin.list_display):
|
||||
try:
|
||||
f = lookup_opts.get_field(field_name)
|
||||
admin_order_field = None
|
||||
except models.FieldDoesNotExist:
|
||||
# For non-field list_display values, check for the function
|
||||
# attribute "short_description". If that doesn't exist, fall
|
||||
@ -86,7 +87,8 @@ def result_headers(cl):
|
||||
header = field_name.replace('_', ' ')
|
||||
|
||||
# It is a non-field, but perhaps one that is sortable
|
||||
if not getattr(getattr(cl.model, field_name), "admin_order_field", None):
|
||||
admin_order_field = getattr(getattr(cl.model, field_name), "admin_order_field", None)
|
||||
if not admin_order_field:
|
||||
yield {"text": header}
|
||||
continue
|
||||
|
||||
@ -101,7 +103,7 @@ def result_headers(cl):
|
||||
|
||||
th_classes = []
|
||||
new_order_type = 'asc'
|
||||
if field_name == cl.order_field:
|
||||
if field_name == cl.order_field or admin_order_field == cl.order_field:
|
||||
th_classes.append('sorted %sending' % cl.order_type.lower())
|
||||
new_order_type = {'asc': 'desc', 'desc': 'asc'}[cl.order_type.lower()]
|
||||
|
||||
|
@ -35,7 +35,6 @@ def Deserializer(stream_or_string, **options):
|
||||
stream = StringIO(stream_or_string)
|
||||
else:
|
||||
stream = stream_or_string
|
||||
#for obj in PythonDeserializer(simplejson.load(stream, cls=DjangoJSONDecoder)):
|
||||
for obj in PythonDeserializer(simplejson.load(stream)):
|
||||
yield obj
|
||||
|
||||
@ -62,25 +61,3 @@ class DjangoJSONEncoder(simplejson.JSONEncoder):
|
||||
# Older, deprecated class name (for backwards compatibility purposes).
|
||||
DateTimeAwareJSONEncoder = DjangoJSONEncoder
|
||||
|
||||
## Our override for simplejson.JSONNumber, because we want to use decimals in
|
||||
## preference to floats (we can convert decimal -> float when they stored, if
|
||||
## needed, but cannot go the other way).
|
||||
#def DjangoNumber(match, context):
|
||||
# match = DjangoNumber.regex.match(match.string, *match.span())
|
||||
# integer, frac, exp = match.groups()
|
||||
# if exp:
|
||||
# res = float(integer + (frac or '') + (exp or ''))
|
||||
# elif frac:
|
||||
# res = decimal.Decimal(integer + frac)
|
||||
# else:
|
||||
# res = int(integer)
|
||||
# return res, None
|
||||
#decoder.pattern(r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?')(DjangoNumber)
|
||||
#
|
||||
#converters = decoder.ANYTHING[:]
|
||||
#converters[-1] = DjangoNumber
|
||||
#decoder.JSONScanner = decoder.Scanner(converters)
|
||||
#
|
||||
#class DjangoJSONDecoder(simplejson.JSONDecoder):
|
||||
# _scanner = decoder.Scanner(converters)
|
||||
#
|
||||
|
@ -25,7 +25,6 @@ django_conversions.update({
|
||||
FIELD_TYPE.DATE: util.typecast_date,
|
||||
FIELD_TYPE.TIME: util.typecast_time,
|
||||
FIELD_TYPE.DECIMAL: util.typecast_decimal,
|
||||
FIELD_TYPE.NEWDECIMAL: util.typecast_decimal,
|
||||
})
|
||||
|
||||
# This should match the numerical portion of the version numbers (we can treat
|
||||
|
@ -185,7 +185,9 @@ The admin represents this as two ``<input type="text">`` fields, with
|
||||
JavaScript shortcuts.
|
||||
|
||||
``DecimalField``
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
**New in Django development version**
|
||||
|
||||
A fixed-precision decimal number, represented in Python by a ``Decimal`` instance.
|
||||
Has two **required** arguments:
|
||||
@ -317,10 +319,17 @@ because the ``match`` applies to the base filename (``foo.gif`` and
|
||||
``FloatField``
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
**Changed in Django development version**
|
||||
|
||||
A floating-point number represented in Python by a ``float`` instance.
|
||||
|
||||
The admin represents this as an ``<input type="text">`` (a single-line input).
|
||||
|
||||
**NOTE:** The semantics of ``FloatField`` have changed in the Django
|
||||
development version. See the `Django 0.96 documentation`_ for the old behavior.
|
||||
|
||||
.. _Django 0.96 documentation: http://www.djangoproject.com/documentation/0.96/model-api/#floatfield
|
||||
|
||||
``ImageField``
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user