Joel Bernstein wrote:
> For an easy (but locale-dependent) way to get a list of the uppercase
> characters in Python, try string.uppercase
>
> http://www.python.org/doc/2.3/lib/module-string.html
>
> Just add that list to your context, and you should be ready to go.
>
> On Jun 17, 12:03 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
>   
>> I would probably just pass in a python list with all of the letters in the
>> alphabet, then just
>> {% for l in alphabet_list %} ...
>> -richard
>>
>> On 6/17/08, M.Ganesh <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>     
>>> Hi All,
>>>       
>>> I am relatively new to both python and django. Please help me to do this :
>>>       
>>> {% for letter in [A to Z] %} <---- how do I write this line in a template?
>>>    <a href=/contacts/entity/?index={{letter}}/>{{letter}}</a>&nbsp;
>>> {% endfor %}
>>>       
>>> Thanks in advance
>>> Regards Ganesh
>>>       
Hi Richard and Joel,

Thanks for your lightning fast replies. I tried this and it worked :

#my view function
    return render_to_response(template,
                              {'object_name' : object.__name__,
                               'app_label' : object._meta.app_label,
                                object_list_name : object_list,
                               'base_template'  : base_template,
                               'alphabet_string' : ascii_uppercase },
                               RequestContext(request))

#my template
    {% for letter in alphabet_string %}
        {{ letter }} &nbsp; - &nbsp;
    {% endfor %}

Thanks once again

Regards Ganesh


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

Reply via email to