On Feb 7, 3:55 am, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> The nth tag doesn't exist yet, but does it look like what you are asking
> for?
Yes, this would be a pretty good solution to the problem.
Thank you everyone for your help.
--~--~-~--~~~---~--~~
You rec
How about putting the separator before the link?
if first, put nothing
else
if last put 'and'
else put a ', '
Derek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
It sounds like you are looking for a tag that would let you be more
concise about this. Something like:
{% for pa in pub.pubauthor_set.all %}
{{ pa.author }}{% nth
forloop.revcounter "" "and" "," %}
{% endfor %}
Where the nth tag works like this: its first argument is an integer
James Bennett helped me with a problem similar to this a few months
ago; you may find his solution useful:
http://groups.google.com/group/django-users/browse_thread/thread/87b915a44fc8cde1/a30af6ce6eaf33c1
Yrs,
Eric
--~--~-~--~~~---~--~~
You received this message b
On Feb 7, 8:30 am, toomim <[EMAIL PROTECTED]> wrote:
> On Feb 6, 11:05 pm, toomim <[EMAIL PROTECTED]> wrote:
>
> > I don't understand, how do I get {{sep}} to change from ',' to 'and'
> > and then to the empty string in the last 2 iterations of the loop,
> > without using a bunch of if statements
On Feb 6, 11:05 pm, toomim <[EMAIL PROTECTED]> wrote:
> I don't understand, how do I get {{sep}} to change from ',' to 'and'
> and then to the empty string in the last 2 iterations of the loop,
> without using a bunch of if statements? (And since we're using
> variables, a {% where %} clause?)
He
On Feb 6, 9:25 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 07-Feb-08, at 10:45 AM, toomim wrote:
>
> compute and add these in your view - you need an extra field, say,
> 'sep' which would be ',', '' or 'and' and in your template:
> whatever {{sep}}
I don't understand, how do I get {{s
On Feb 6, 9:29 pm, "Swaroop C H" <[EMAIL PROTECTED]> wrote:
> If I've understood your question correctly, you can use 'forloop.last'
> to determine if you're in the last iteration...
> seehttp://www.djangobook.com/en/1.0/chapter04/for details.
Yes, that's what I use for the last iteration. Then
On Feb 7, 2008 10:45 AM, toomim <[EMAIL PROTECTED]> wrote:
>
> I am looping through a list of people, and want to output their
> hyperlinked names separated by commas and then the word "and".
If I've understood your question correctly, you can use 'forloop.last'
to determine if you're in the las
On 07-Feb-08, at 10:45 AM, toomim wrote:
> What is the best way of implementing this in a django template? Right
> now I'm using a {% for %} loop, where each iteration prints a "," or
> "and" or nothing depending on the iteration of the loop, using a bunch
> of {% if %} statements to branch on t
I am looping through a list of people, and want to output their
hyperlinked names separated by commas and then the word "and". It
should look like this:
Bob,
Fred,
Deidre and
Kelly
What is the best way of implementing this in a django template? Right
now I'm using a {% for %} loop, where each it
11 matches
Mail list logo