Hola, puedes utilizar un for y guardar la salida en un query aunque por 
optimización los queries de django solo se ejecutan en el momento de usarlos 
entonces podrias crear un templetag para esto.


def cliente(request):
...
...
    clientes = Clientes.objects.order_by('Nombre')
    queries = {}
    for a in range(97, 123):
        queries[a] = clientes.filter(Nombre__starswith=a)
...
...
    print queries['f']
    print queries['z']


> 
> def clientes(request):
>     clientes = Clientes.objects.order_by('Nombre')
>     clientes2 = Clientes.objects.order_by('Nombre').filter(medio='1')
>     clientes3 = Clientes.objects.order_by('Nombre').filter(medio='2')
>     clientes4 = Clientes.objects.order_by('Nombre').filter(medio='3')
>     c = Clientes.objects.filter( Nombre__startswith='a').order_by('Nombre')
>     template = 'products/Clientes.html'
>     return render(request, template, locals())
> 
> tengo el siguiente problema quiero filtrar por la letra del abecedario y lo 
> realizo con 
> 
>   c = Clientes.objects.filter( Nombre__startswith='a').order_by('Nombre')
> 
> pero tengo uno para cada letra nose si me puedan ayudar con alguna funcion 
> que me facilite obtener esto
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d29776bb-a965-4a89-a2af-00e539d03bea%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20151109174657.GA24937%40pehik.co.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: PGP signature

Reply via email to