diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2014-11-27 02:41:27 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-03 14:27:38 -0500 |
| commit | 560b4207b1490a7d0cbf70cfbeba7daf2082e5be (patch) | |
| tree | 9656c5e6a5d0de63024bb5ff2291963f4f236100 /docs/ref | |
| parent | 50c1d8f24b0d04c813b3dd34720df86446091afa (diff) | |
Removed redundant numbered parameters from str.format().
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 6 | ||||
| -rw-r--r-- | docs/ref/utils.txt | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index a85993cd2e..fd6d8f5f3a 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -590,7 +590,7 @@ subclass:: color_code = models.CharField(max_length=6) def colored_name(self): - return format_html('<span style="color: #{0};">{1} {2}</span>', + return format_html('<span style="color: #{};">{} {}</span>', self.color_code, self.first_name, self.last_name) @@ -647,7 +647,7 @@ subclass:: color_code = models.CharField(max_length=6) def colored_first_name(self): - return format_html('<span style="color: #{0};">{1}</span>', + return format_html('<span style="color: #{};">{}</span>', self.color_code, self.first_name) @@ -1060,7 +1060,7 @@ subclass:: # line by a linebreak return format_html_join( mark_safe('<br/>'), - '{0}', + '{}', ((line,) for line in instance.get_full_address()), ) or "<span class='errors'>I can't determine this address.</span>" diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index b32f0a838b..56e9fb7dce 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -605,7 +605,7 @@ escaping HTML. You should instead use:: - format_html("{0} <b>{1}</b> {2}", + format_html("{} <b>{}</b> {}", mark_safe(some_html), some_text, some_other_text) This has the advantage that you don't need to apply :func:`escape` to each @@ -627,7 +627,7 @@ escaping HTML. ``args_generator`` should be an iterator that returns the sequence of ``args`` that will be passed to :func:`format_html`. For example:: - format_html_join('\n', "<li>{0} {1}</li>", ((u.first_name, u.last_name) + format_html_join('\n', "<li>{} {}</li>", ((u.first_name, u.last_name) for u in users)) .. function:: strip_tags(value) |
