Key differences
From NDjango
This article is a collection of discrepancies between the NDjango implementation and native django
Date Formatting
Date and time formatting is done by mapping the django date formatting elements to .net date formatting elements. Django formatting elements without direct mapping are not currently implemented
Filter implementations
- Future direction
- Configuration options will be provided to make the default culture configurable. At this moment
CultureInfo.CurrentCultureused
- .NET string are unicode, so little work is done with encodings (this excludes some specific url conversion filters)
- Currently, the
safeattribute on filters (that directs the runtime to not perform escaping) is not supported - NDjango uses
IEnumerableto identify lists. If the object doesn't implementIEnumerable, it will be converted to string throughConvert.ToString()(however for DictSort and DictSortReversed filters such conversion doesn't take place)
- Conversion of the filter value or argument to integers
- Algorithm of conversion input object to the integer is as follows:
- In Django:
- (As from python documentation)
- To correctly convert argument to integer it must be a (possibly signed) number, or number literal, possibly embedded in a whitespace.
- If argument is a string - the proper base of the input number literal(binary, hexadecimal, octal or decimal) is determined based on the contents of string see [[1]];
- The argument may be a plain or long integer(long integer has unlimited precision) integer or a floating point number.
- Conversion of floating point numbers to integers truncates (towards zero). If the argument is outside the integer range a long object will be returned instead. If no arguments are given, returns 0.
- In NDjango:
- Difference is that argument (in case it's a string literal) considered to be in decimal form, it can be an integer or a floating point number. Output number is limited to Int32(-2,147,483,648 through 2,147,483,647), long integers with unlimited precision are not supported at this time. Conversion of floats to integer rounds toward nearest integer.
- If argument is not a string literal it will be converted to string using
Convert.ToString