Keshav Kumar
f37d548ede
Fixed #20995 -- Added support for iterables of template names to {% include %} template tag.
...
Thanks Adam Johnson for the review.
2020-02-18 06:56:05 +01:00
Patrick Seebauer
e3d546a1d9
Fixed #31128 -- Fixed TemplateSyntaxError in simple_tag() and inclusion_tag() for kwargs.
2020-01-02 10:44:07 +01:00
Mike Hansen
35d36d9462
Refs #30585 -- Updated project templates and tests to use (block)translate tags.
2019-12-18 13:15:38 +01:00
Baptiste Mispelon
09341856ed
Used Signature API instead of deprecated inspect.getcallargs().
...
inspect.getcallargs() was deprecated in Python 3.5 and the Signature
API (PEP 362) has better support for decorated functions (by default,
it follows the __wrapped__ attribute set by functools.wraps for
example).
2019-12-10 09:36:34 +01:00
Baptiste Mispelon
23af086665
Used full module import for inspect in template/base.py.
2019-12-10 08:29:30 +01:00
Hasan Ramezani
8d32290279
Fixed #30425 -- Handled jinja2.TemplateSyntaxError when rendering a template.
...
Jinja raises jinja2.TemplateSyntaxError in render() not in
get_template() when it's in an included template.
2019-11-27 12:48:07 +01:00
Jon Dufresne
aa12cf07c9
Removed unnecessary numeric indexes in format strings.
2019-11-19 08:29:47 +01:00
Jon Dufresne
77aa74cb70
Refs #29983 -- Added support for using pathlib.Path in all settings.
2019-11-07 10:26:22 +01:00
Sky
3cf907c20c
Fixed #30761 -- Prevented floatformat filter from returning a negative zero.
2019-10-31 10:48:35 +01:00
Hasan Ramezani
e3d0b4d550
Fixed #30899 -- Lazily compiled import time regular expressions.
2019-10-29 09:22:26 +01:00
Alex Gaynor
04ac9b45a3
Improved performance of django.template.base.Parser.
...
pop(0), which is used to fetch each token, is O(n) in the length of the
list. By reversing the list and operating off the end, we can perform
next_token(), prepend_token(), and delete_first_token() in constant
time.
2019-10-09 08:33:16 +02:00
Min ho Kim
103a6f4307
Fixed some typos in comments and docs.
...
Thanks to Mads Jenson for review.
2019-10-02 15:50:46 +02:00
ElizabethU
54ea290e5b
Fixed #30651 -- Made __eq__() methods return NotImplemented for not implemented comparisons.
...
Changed __eq__ to return NotImplemented instead of False if compared to
an object of the same type, as is recommended by the Python data model
reference. Now these models can be compared to ANY (or other objects
with __eq__ overwritten) without returning False automatically.
2019-10-01 17:58:19 +02:00
Mads Jensen
129583a0d3
Removed some outdated backwards compatibility imports and misleading comments.
...
EmptyResultSet moved in 46509cf13d
.
FieldDoesNotExist moved in 8958170755
.
BoundField and pretty_name moved in 8550161e53
.
EMPTY_VALUES moved in 471596fc1a
.
BaseRunserverCommand moved in 5c53e30607
.
2019-09-24 15:18:53 +02:00
Mariusz Felisiak
3d716467a9
Refs #29817 -- Removed settings.FILE_CHARSET per deprecation timeline.
2019-09-10 12:01:00 +02:00
Jon Dufresne
9e38ed0536
Fixed #27486 -- Fixed Python 3.7 DeprecationWarning in intword and filesizeformat filters.
...
intword and filesizeformat passed floats to ngettext() which is
deprecated in Python 3.7. The rationale for this warning is documented
in BPO-28692: https://bugs.python.org/issue28692 .
For filesizeformat, the filesize value is expected to be an int -- it
fills %d string formatting placeholders. It was likely coerced to a
float to ensure floating point division on Python 2. Python 3 always
does floating point division, so coerce to an int instead of a float to
fix the warning.
For intword, the number may contain a decimal component. In English, a
decimal component makes the noun plural. A helper function,
round_away_from_one(), was added to convert the float to an integer that
is appropriate for ngettext().
2019-06-11 20:34:59 +02:00
Batuhan Taşkaya
5c19274643
Fixed #30453 -- Fixed crash of simple_tag() and inclusion_tag() when function is wrapped.
...
getfullargspec() doesn't work with wrapped functions.
2019-05-17 09:53:24 +02:00
sanchjat
21aa2a5e78
Removed unnecessary line in DebugLexer.tokenize().
2019-05-07 13:34:05 +02:00
Tobias Kunze
e683613649
Fixed #20122 -- Made pluralize template filter return '' on invalid input.
2019-05-03 11:35:20 +02:00
Tobias Kunze
e3968df527
Refs #20122 -- Corrected documentation of pluralize template filter.
2019-05-03 11:35:19 +02:00
Jon Dufresne
8b3f1c35dd
Removed unnecessary assignments in various code.
2019-04-24 13:09:29 +02:00
Nathan Gaberel
624573726a
Fixed #29791 -- Made Engine.render_to_string() honor autoescape.
2019-03-25 17:59:07 -04:00
Tim Graham
77d25dbd0f
Refs #27753 -- Favored SafeString over SafeText.
2019-02-06 14:12:06 -05:00
Nick Pope
24b82cd201
Fixed #30159 -- Removed unneeded use of OrderedDict.
...
Dicts preserve order since Python 3.6.
2019-02-06 13:48:39 -05:00
Tom Forbes
7eb4db8732
Removed template_cache attribute from cached template loader.
...
Unused since 5d8da093a9
.
2019-01-18 18:35:00 -05:00
Tim Graham
fe6d5a2da2
Fixed #30107 -- Removed unused dirs variable from cache template loader keys.
...
Unused since 5d8da093a9
.
2019-01-18 10:14:41 -05:00
Tim Graham
0004daa536
Used 4 space hanging indent for dictionaries.
...
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Sergey Fedoseev
8ef8bc0f64
Refs #28909 -- Simplifed code using unpacking generalizations.
2018-09-28 09:57:12 -04:00
Jon Dufresne
82f286cf6f
Refs #29784 -- Switched to https:// links where available.
2018-09-26 08:48:47 +02:00
Jon Dufresne
ad9a28ee38
Refs #29784 -- Normalized Python docs links to omit the version.
2018-09-25 10:19:42 +02:00
Claude Paroz
201017df30
Fixed #29654 -- Made text truncation an ellipsis character instead of three dots.
...
Thanks Sudhanshu Mishra for the initial patch and Tim Graham for the review.
2018-08-21 17:46:45 +02:00
luz.paz
97e637a87f
Fixed typos in comments and docs.
2018-08-01 16:09:22 -04:00
Dražen Odobašić
9f3b9ffd51
Fixed #29617 -- Fixed Template crash if template_string is lazy.
...
Regression in 3a148f958d
.
2018-07-31 09:57:11 -04:00
Sergey Fedoseev
529c3f264d
Simplified BaseContext.__iter__().
2018-07-11 09:12:50 -04:00
Sergey Fedoseev
857f860d56
Removed unneded str() calls prior to mark_safe(); simplified mark_safe().
2018-07-09 11:25:11 -04:00
ryabtsev
b4fd9b5ad4
Fixed #29432 -- Allowed passing an integer to the slice template filter.
2018-05-26 20:56:51 -04:00
Ryan Rubin
a8d12bc280
Fixed #29400 -- Fixed crash in custom template filters that use decorated functions.
...
Regression in 620e9dd31a
.
2018-05-25 11:11:46 -04:00
Claude Paroz
9c4ea63e87
Replaced TOKEN_* constants by TokenType enums.
...
Thanks Tim Graham for the review.
2018-05-10 17:51:51 +02:00
CHI Cheng
98019df855
Used double quotation marks for csrf form element.
2018-05-03 08:57:18 +02:00
Tom
11b8c30b9e
Ref #23919 -- Replaced some os.path usage with pathlib.Path.
2018-04-19 21:30:00 -04:00
Jirka Vejrazka
6148dda72f
Fixed #29288 -- Made {% widthratio %} assign to as var if an exception occurs.
2018-04-04 14:03:16 -04:00
Mads Jensen
623117d1f1
Removed unnecessary variable in Lexer.create_token().
2018-03-24 19:10:56 -04:00
Mariusz Felisiak
074a2f7f58
Refs #28909 -- Simplifed code using unpacking generalizations.
2018-02-26 18:23:31 +01:00
Hasan Ramezani
5033999153
Fixed #29154 -- Corrected examples in pluralize docstring and added tests.
2018-02-23 14:20:00 -05:00
Jon Dufresne
1f3852b708
Refs #27795 -- Removed force_bytes() usage in django/template/loaders/cached.py.
2018-02-10 11:25:47 -05:00
Jonas Haag
8c709d79cb
Fixed #17419 -- Added json_tag template filter.
2018-02-07 18:38:12 -05:00
Roger Gammans
d0b44c44ef
Fixed #29060 -- Made {% firstof %} assign '' to the asvar if all inputs are false.
2018-01-25 13:40:51 -05:00
Jon Dufresne
ff05de760c
Fixed #29038 -- Removed closing slash from HTML void tags.
2018-01-21 02:09:10 -05:00
Дилян Палаузов
4c599ece57
Fixed #28930 -- Simplified code with any() and all().
2017-12-26 17:11:15 -05:00
Mariusz Felisiak
78247b80a8
Simplified and improved performance of floatformat filter.
...
Thanks Sergey Fedoseev for the review.
2017-12-19 05:08:10 -10:00