Re: Possible bug in interaction between 'block' and 'include' in Django Templates

2015-09-10 Thread Suriya Subramanian
I got the answer on IRC that this is not a bug as explained in the documentation for include https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#include Suriya On Thursday, September 10, 2015 at 2:55:42 PM UTC+5:30, Suriya Subramanian wrote: > > Hi, > > I think there is

Possible bug in interaction between 'block' and 'include' in Django Templates

2015-09-10 Thread Suriya Subramanian
template is unable to override the block defined in the include file. My understand is that, a file and block included within a parent template should be considered a part of the parent. However, that does not seem to be the case. Thanks, Suriya -- You received this message because you

Re: Django ORM Interaction between order_by(), distinct(), and filter()

2015-06-01 Thread Suriya Subramanian
I found a way to express the second query in the ORM. Person.objects.filter(sex='F', pk__in=tallest_people) Thanks, Suriya On Monday, June 1, 2015 at 12:13:49 PM UTC+5:30, Suriya Subramanian wrote: > > I have a question about how order_by(), distinct(), and filter() interact. > This

Django ORM Interaction between order_by(), distinct(), and filter()

2015-06-01 Thread Suriya Subramanian
allest_in_their_city = [ p for p in tallest_people if (p in tallest_females) ] # Ideally, I'd like to write: # Person.objects.order_by('city', '-height').distinct('city').filter(sex='F').values_list('pk', flat=True) What's a way to compute the results of the second query fully in the databas

Re: Leveraging the ORM for very complex queries

2015-05-17 Thread Suriya Subramanian
sqlparams = [ sqlparams_from_queryset(qs) for qs in querysets ] (sqls, params) = zip(*sqlparams) # zip(*...) is the inverse of zip params = tuple(itertools.chain.from_iterable(params)) cursor = connection.cursor() cursor.execute(sqltemplate.format(*sqls), params) return cur

Re: Leveraging the ORM for very complex queries

2015-05-04 Thread Suriya Subramanian
and filtering). Composing SQL and ORM, even if it means having to deal with the guts of SQLCompiler.as_sql() seems to be a decent solution for me. I am asking if there any best practices to follow or gotchas to watch out for. Thanks, Suriya On Monday, May 4, 2015 at 5:35:50 AM UTC+5:30, Russell Ke

Leveraging the ORM for very complex queries

2015-05-02 Thread Suriya Subramanian
the complex query? What are some gotchas that I need to watch out for? Thanks, Suriya Subramanian -- 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 dj

Re: Database API question: I am not able to return a QuerySet

2006-07-31 Thread Suriya
DavidA wrote: > Suriya, > > You will probably have to do this in custom SQL or using extra(). Your > query requires a subselect to get the "current B's" (B's with max(date) > for each A). > > Here's the SQL that I think you need (if I understand the problem > cor

Re: Database API question: I am not able to return a QuerySet

2006-07-31 Thread Suriya
o entries: B(id=1, a=1, status=1, date=yesterday) and B(id=2, a=1, status=0, date=today) a = 1 should not be returned in the list, because the current status is 0. Suriya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Database API question: I am not able to return a QuerySet

2006-07-30 Thread Suriya
ValidAsManager does not return a QuerySet. Could someone tell me what I can do to return a QuerySet? How can I use the filter function to do so? If you feel my schema is incorrect, I can consider changing it. Thanks, Suriya --~--~-~--~~~---~--~~ You rec