Django

Code

Ticket #208 (closed: fixed)

Opened 3 years ago

Last modified 10 months ago

Allow the strings the cycle tag uses to contain spaces

Reported by: anonymous Assigned to: SmileyChris
Milestone: Component: Template system
Version: SVN Keywords: sprintsept14
Cc: espen@grindhaug.org Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

I would like to be able to use the cycle tag like so:

{% cycle <td class="tdClass">,</tr><tr><td class="tdClass"> %}

The current cycle tag (as I understand it) does not allow spaces or a way to escape spaces.

Attachments

208.patch (7.6 kB) - added by chris.mcavoy@gmail.com on 02/27/07 18:02:55.
Patch that changes behavior of cycle tag according to Adrian's description.
208.2.patch (8.1 kB) - added by EspenG on 03/25/07 04:50:32.
Fixes a little bug in the admin interface
208.3.patch (10.4 kB) - added by EspenG on 03/30/07 07:40:18.
This patch is also got backwards compatibility.
208.4.patch (6.7 kB) - added by SmileyChris on 09/13/07 20:13:10.
new patch, reviewed and refactored
208-update-templates.patch (8.8 kB) - added by SmileyChris on 09/13/07 20:14:57.
separate patch which should be applied - updates admin and databrowse templates to use new format

Change History

11/08/05 18:49:46 changed by rjwittams

I think this would be better handled with a blockcycle tag. Eg {%blockcycle %}

<td class="tdClass">

{%next%}

</tr><tr><td class="tdClass">

{%endblockcycle %}

Not that I'm sure this example is very good....

03/19/06 20:16:27 changed by SmileyChris

Patch #1522 would fix this

06/07/06 23:37:48 changed by adrian

Now that we have an intelligent string splitter in the template system, I'd like to change cycle in a backwards-incompatible way, so that you'd pass in strings, separated by spaces. Examples:

{% cycle 'value 1' 'value 2' %} {% cycle 'value 1' 'value 2' 'value 3' %} {% cycle 'value 1' 'value 2' as foo %}

Variables would be allowed as the cycle values, too:

{% cycle some_var 'some value' %}

06/07/06 23:37:57 changed by adrian

  • status changed from new to assigned.

01/21/07 00:39:21 changed by Gary Wilson <gary.wilson@gmail.com>

  • stage changed from Unreviewed to Accepted.

Marking as accepted since Adrian stated how he would like this tag to change.

02/27/07 18:02:55 changed by chris.mcavoy@gmail.com

  • attachment 208.patch added.

Patch that changes behavior of cycle tag according to Adrian's description.

02/27/07 18:06:40 changed by anonymous

  • has_patch set to 1.
  • version set to SVN.

03/25/07 04:49:56 changed by EspenG

I found a bug in the admin interface while using the patch attached to this ticket. I also looked around for more of the same bug in the admin interface but could not find any. Will upload a new patch that fixes this bug.

03/25/07 04:50:32 changed by EspenG

  • attachment 208.2.patch added.

Fixes a little bug in the admin interface

03/27/07 17:48:55 changed by anonymous

  • summary changed from Allow the strings the cycle tag uses to contain spaces. to [patch]Allow the strings the cycle tag uses to contain spaces..

03/27/07 20:46:51 changed by mtredinnick

  • summary changed from [patch]Allow the strings the cycle tag uses to contain spaces. to Allow the strings the cycle tag uses to contain spaces..

No need to put [patch] in the title any longer. We have the "has patch" flag for that purpose.

03/28/07 00:43:48 changed by SmileyChris

I'd like to see this with backwards compatibility which is possible: After checking for as something, you can see if there's only one bit left with commas, in which case use the old method.

03/30/07 07:40:18 changed by EspenG

  • attachment 208.3.patch added.

This patch is also got backwards compatibility.

04/12/07 17:48:29 changed by anonymous

  • cc set to espen@grindhaug.org.

09/13/07 19:17:38 changed by SmileyChris

  • owner changed from nobody to SmileyChris.
  • status changed from assigned to new.

09/13/07 20:13:10 changed by SmileyChris

  • attachment 208.4.patch added.

new patch, reviewed and refactored

09/13/07 20:14:57 changed by SmileyChris

  • attachment 208-update-templates.patch added.

separate patch which should be applied - updates admin and databrowse templates to use new format

09/13/07 20:15:39 changed by SmileyChris

  • summary changed from Allow the strings the cycle tag uses to contain spaces. to Allow the strings the cycle tag uses to contain spaces.
  • stage changed from Accepted to Ready for checkin.

09/13/07 20:16:53 changed by SmileyChris

  • keywords deleted.

So just to clarify, 208.patch contains just the code and 208-update-templates.patch contains just the template changes.

09/13/07 20:18:08 changed by SmileyChris

(Thanks to Philippe Raoult for writing the new docs)

09/13/07 21:49:21 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [6153]) Fixed #208 -- Modernized the syntax of the cycle tag to allow for spaces and variables in cycle values. Thanks to SmileyChris? and Chris McAvoy? for their work on this.

09/14/07 10:12:29 changed by George Vilches <gav@thataddress.com>

  • keywords set to sprintsept14.

Add/Change #208 (Allow the strings the cycle tag uses to contain spaces)




Change Properties
Action