Re: Noob question: Templates: How to count for loop?

2010-02-16 Thread mhulse
Many thanks for the help rebus_ and Daniel! All of your suggestions,
code samples, and links have been extremely helpful.

I appreciate it.

Have a great day!

Cheers,
Micky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-16 Thread Daniel Roseman
On Feb 16, 2:12 am, mhulse  wrote:
> > You could do it like this. There was a discussion recently about mod
> > operator and what happens when you want to do something every N times
> > but can't find it now for some reason :(
>
> Ah, interesting! Thanks for the code sample, I really appreciate your
> assistance.
>
> I will search around for the mod operator discussion... Sounds like it
> could be a good read for me. :)
>
> Thanks again!
>
> Micky

There's also the built-in "divisibleby" filter, which is a bit like
mod:

{% if value|divisibleby:"6" %}

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> You could do it like this. There was a discussion recently about mod
> operator and what happens when you want to do something every N times
> but can't find it now for some reason :(

Ah, interesting! Thanks for the code sample, I really appreciate your
assistance.

I will search around for the mod operator discussion... Sounds like it
could be a good read for me. :)

Thanks again!

Micky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:58, mhulse  wrote:
>> Hrmm, forloop.counter. It is one of those days. :P
>
> But, how can I tell if it is every third item?
>
> Also, is there a way to check if the current number is even?
>
> In a PHP template, I might do this:
>
> ... forloop ...
> 
> ... endforloop ...
>
> Sorry if silly question.
>
> Thanks!
> M
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#divisibleby
http://groups.google.com/group/django-developers/browse_thread/thread/20c309376c46590d?hl=en#

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:58, mhulse  wrote:
>> Hrmm, forloop.counter. It is one of those days. :P
>
> But, how can I tell if it is every third item?
>
> Also, is there a way to check if the current number is even?
>
> In a PHP template, I might do this:
>
> ... forloop ...
> 
> ... endforloop ...
>
> Sorry if silly question.
>
> Thanks!
> M
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

{% for photo in photos %}

stuff
{% endfor %}

You could do it like this. There was a discussion recently about mod
operator and what happens when you want to do something every N times
but can't find it now for some reason :(

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Check out "cycle"  template tag too.
> http://docs.djangoproject.com/en/dev/ref/templates/builtins/#cycle

Thanks rebus_! I have played with that just a little bit. I will
explore it further.

Cheers,
Micky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Hrmm, forloop.counter. It is one of those days. :P

But, how can I tell if it is every third item?

Also, is there a way to check if the current number is even?

In a PHP template, I might do this:

... forloop ...

... endforloop ...

Sorry if silly question.

Thanks!
M

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:52, mhulse  wrote:
>> Is this possible? I am sure it is... Any tips ya'll could send my way
>> would be spectacular!
>
> Hrmm, forloop.counter. It is one of those days. :P
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

Check out "cycle"  template tag too.

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#cycle

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Is this possible? I am sure it is... Any tips ya'll could send my way
> would be spectacular!

Hrmm, forloop.counter. It is one of those days. :P

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
Hi,

In my template:

{% for photo in photos %}

stuff
{% endfor %}

Is this possible? I am sure it is... Any tips ya'll could send my way
would be spectacular!

Thanks!
Micky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.