Commit Graph

421 Commits

Author SHA1 Message Date
Mariusz Felisiak 4a43335d30
Fixed #30086, Refs #32873 -- Made floatformat template filter independent of USE_L10N. 2021-09-08 08:37:27 +02:00
Matt Westcott 5092f7247d Fixed #33036 -- Made simple_tag()/inclusion_tag() with takes_context raise TemplateSyntaxError when function has no parameters. 2021-08-19 07:39:55 +02:00
Mariusz Felisiak 65ed96fa39 Refs #33002 -- Added DebugLexer/Lexer.tokenize() test for trailing text token. 2021-08-09 13:42:26 +02:00
Chris Jerdonek b2be7e12cc Refs #33002 -- Made template_tests.tests.py's tests test both Lexer and DebugLexer. 2021-08-09 13:37:02 +02:00
Greg Twohig c99aaf14ee Refs #32990 -- Added tests for DebugLexer/Lexer.tokenize(). 2021-08-09 08:21:37 +02:00
Mariusz Felisiak 34d5336b9d Added test for TemplateSyntaxError when variables begin with underscores. 2021-08-02 11:37:39 +02:00
David Smith f9b7704ab3
Refs #32956 -- Corrected spelling of "gray". 2021-08-02 07:51:24 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
cammil 313c3d1aa1 Fixed #28935 -- Fixed display of errors in extended blocks.
Get the template that caused the exception and get the
exception info from that template, using the node that
caused the exception.
2021-07-02 11:38:15 +02:00
Keryn Knight 854e9b0668 Fixed #32824 -- Improved performance of NodeList.render().
This avoids the following:
 - checking that each item in the nodelist is a subclass of Node,
 - calling str() on the render_annotated() output, because it's
   documented that Node.render() must return a string,
 - calling mark_safe() on the output, when the value to be wrapped is
   definitively known to be a string because the result of ''.join()
   is always of that type,
 - using an intermediate list to store each individual string.
2021-06-11 12:22:06 +02:00
saeedblanchette 66ed03e7c9 Refs #24121 -- Added __repr__() to AdminForm, BlockContext, BlockTranslateNode, and IncludeNode. 2021-06-10 12:47:53 +02:00
abhiabhi94 c609d5149c Refs #24121 -- Added __repr__() to Engine 2021-06-01 07:44:36 +02:00
Hasan Ramezani 68357b2ca9 Fixed #32744 -- Normalized to pathlib.Path in autoreloader check for template changes. 2021-05-26 09:41:29 +02:00
saeedblanchette e6406853c3 Refs #24121 -- Added__repr__() to StaticNode. 2021-05-12 08:41:52 +02:00
Tiago Honorato 4f4f770f77 Refs #24121 -- Added __repr__() to Origin and Template. 2021-03-17 07:49:55 +01:00
François Freitag 7ca7f4495b Refs #21429 -- Added SimpleTestCase.assertNoLogs() on Python < 3.10. 2021-03-02 20:35:33 +01:00
Rohith PR d3ecef26b9 Refs #24121 -- Added __repr__() to URLNode. 2021-03-02 12:24:49 +01:00
David Smith 179ee13eb3 Refs #24121 -- Added __repr__() to FilterExpression, Lexer, Parser, and Token. 2021-02-26 10:25:08 +01:00
Markus Holtermann 50a5f8840f Refs #32394 -- Changed STATIC_URL/MEDIA_URL to relative paths in tests and docs where appropriate. 2021-02-06 13:41:35 +01:00
Hasan Ramezani c978dd93fd Fixed #32290 -- Fixed TemplateNotFound in {% include %} tag for relative path in variable. 2021-01-27 10:07:31 +01:00
Hasan Ramezani 640a6e1dce Refs #32290 -- Added {% extends %} test for relative path in variable. 2021-01-27 09:37:03 +01:00
Mariusz Felisiak e7208f13c0 Refs #25236 -- Removed {% ifequal %} and {% ifnotequal %} template tags per deprecation timeline. 2021-01-14 17:50:04 +01:00
Hasan Ramezani 577f2338f1 Fixed #32208 -- Allowed adding lazy() objects.
Co-authored-by: Claude Paroz <claude@2xlibre.net>
2020-12-21 09:24:41 +01:00
Daniel Hahler c70cd2a926 Refs #15053 -- Clarified debug message when skipping templates to avoid recursion. 2020-11-21 10:49:31 +01:00
Nick Pope 477c800443
Changed docs and a code comment to use gender-neutral pronouns.
Follow up to e1b7723817.
2020-11-13 22:26:30 +01:00
Tom Forbes 658bcc16f1 Fixed #25791 -- Implement autoreload behaviour for cached template loader. 2020-11-05 15:30:52 +01:00
Tom Forbes 29845ecf69 Refs #25791 -- Added get_dirs() method to cached template loader. 2020-11-05 15:30:52 +01:00
Jacob Walls ac6c426007 Fixed #20601 -- Allowed forcing format with thousand separators in floatformat filter.
Thanks Claude Paroz and Nick Pope for reviews.
2020-10-13 10:36:46 +02:00
Tom Carrick dcb69043d0 Fixed #32002 -- Added headers parameter to HttpResponse and subclasses. 2020-10-07 09:19:57 +02:00
Jacob Walls 01a7af09b9 Fixed #18995 -- Made blocktranslate tag raise TemplateSyntaxError when plural count is not a number. 2020-09-29 08:03:51 +02:00
Tom Carrick bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Jon Dufresne 81d69568a6 Made test_once a keyword argument in template_tests.utils.setup().
Replaces the kwargs.get(...) pattern. Helps avoid typos by providing a
better error message in case of misuse.
2020-05-21 08:09:19 +02:00
David Smith 03537e2458
Completed lorem tag test coverage. 2020-05-14 12:36:38 +02:00
Jon Dufresne 72a170b4c3 Fixed #25236 -- Deprecated {% ifequal %} and {% ifnotequal %} template tags.
The {% if %} tag provides all features of these tags.

Since Django 1.2 (May 17, 2010), the docs have hinted that
{% ifequal %} and {% ifnotequal %} will be deprecated in a future
Django version. Time to make it official.
2020-05-11 09:07:33 +02:00
Jon Dufresne d8cb8fdf40 Switched unittest.TestCase to SimpleTestCase in template_tests/test_nodelist.py. 2020-05-11 07:56:11 +02:00
Nick Pope 8f10ceaa90 Changed `'%s' % value` pattern to `str(value)`. 2020-05-04 08:27:18 +02:00
Jon Dufresne 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02:00
Claude Paroz 4d973f5939 Refs #26601 -- Deprecated passing None as get_response arg to middleware classes.
This is the new contract since middleware refactoring in Django 1.10.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-02-18 20:03:44 +01:00
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
Hasan Ramezani fc4f45ebdc Used assertRaisesMessage() in various tests. 2020-02-07 12:46:23 +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
Mike Hansen d291c72bf2 Fixed #30585 -- Added {% translate %} and {% blocktranslate %} template tags. 2019-12-18 13:15:38 +01:00
Jon Dufresne aa12cf07c9 Removed unnecessary numeric indexes in format strings. 2019-11-19 08:29:47 +01:00
Jon Dufresne 39791c8e6d Harmonized Windows checks in tests to a single style. 2019-11-06 15:14:30 +01:00
Sky 3cf907c20c Fixed #30761 -- Prevented floatformat filter from returning a negative zero. 2019-10-31 10:48:35 +01:00
Sky 459de8dc29 Added more tests for floatformat filter with negative values. 2019-10-31 10:07:59 +01:00
Nick Pope 7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01: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