Re: Suggestion for prefetch_related() documentation

2022-06-25 Thread Laurent Lyaudet
Hello, Thanks for the link :) I think the documentation would be better structured, then, if https://docs.djangoproject.com/fr/4.0/ref/models/querysets/ would reference your link. I have not read all of Django documentation. I do not know if it is expected that most developers would read everythi

Re: Suggestion for prefetch_related() documentation

2022-06-23 Thread Jason
This is explicitly called out in the documentation at https://docs.djangoproject.com/en/4.0/topics/db/optimization/#understand-queryset-evaluation On Thursday, June 23, 2022 at 1:17:50 PM UTC-4 laurent...@gmail.com wrote: > Hello, > > I made a simple test to check the number of queries done : >

Re: Suggestion

2015-03-19 Thread Johan Hendriks
Op 18-03-15 om 07:38 schreef Jay Prasad: Hi All, I'm started Pyhthon and django ,give me some suggestions and which sites was good .help me.thank you all -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsub

Re: Suggestion for using distinct on django 1.4+ in your unit tests?

2013-03-06 Thread Brad Pitcher
I believe sqlite supports "distinct" just not "distinct on". I have always managed to find workarounds using "distinct" anywhere I formerly used "distinct on". On Mar 6, 2013 7:01 AM, "Toran Billups" wrote: > I recently upgraded to django 1.4 and found that my "distinct" queries > don't work anym

Re: suggestion for dependency injection in view tests

2011-10-04 Thread Stuart
Also, depending on your scenario, the classes might be overkill. You could just as easily pass in a callable. In that case your view would look something like this... def suggest(request, usrid=None, get_friends=__get_friends):     current_user = request.facebook.user     facebook_friends = get_fr

Re: suggestion for dependency injection in view tests

2011-10-04 Thread Stuart
Here is one approach... class FBFriends: def get_friends(self, current_user): return __get_friends(current_user) # heavy call def suggest(request, usrid=None, friend_source=FBFriends()): current_user = request.facebook.user facebook_friends = friend_source.get_friends(current_

Re: Suggestion: IPAddressFields should take auto_now and auto_now_add

2009-05-29 Thread Bojan Mihelac
James, I don't think model should know anything about request like is IP address. This would violate MVC principle. Bojan On May 29, 1:25 am, JamesJOG wrote: > I have a model with an IPAddressField (1) and some views that have to > write to that field every time they save (2) ... Wouldn't it be

Re: suggestion on querying external database

2009-05-11 Thread tekion
Thanks for the update. This is very useful information. On May 10, 9:41 pm, Karen Tracey wrote: > On Sun, May 10, 2009 at 8:45 PM, tekion wrote: > > > Yes. I saw this link. My impression on first read is that it imports > > the database into Django's database. I am not looking for this. I am >

Re: suggestion on querying external database

2009-05-10 Thread Karen Tracey
On Sun, May 10, 2009 at 8:45 PM, tekion wrote: > > Yes. I saw this link. My impression on first read is that it imports > the database into Django's database. I am not looking for this. I am > looking to just be able to read in the data from the external database > and leave the maintenance of th

Re: suggestion on querying external database

2009-05-10 Thread tekion
Yes. I saw this link. My impression on first read is that it imports the database into Django's database. I am not looking for this. I am looking to just be able to read in the data from the external database and leave the maintenance of the database to the external application. Has anyone done

Re: suggestion on querying external database

2009-05-10 Thread Dougal Matthews
This might be useful; http://docs.djangoproject.com/en/dev/howto/legacy-databases/ It describes how to create models for your existing databases. However, it wont stop you being able to make writes with the django ORM. Dougal --- Dougal Matthews - @d0ugal http://www.dougalmatthews.com/ 2009/5

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread Rock
> > > Talking through my hat?No, I think not -- I think that syntax > > (``queryset.groupby(field).max()``) > actually looks like the best proposal for aggregates I've seen thus far... > Sounds pretty good to me. Besides the usual min, max and such, I also like: queryset.groupby(field).stats()

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread Jacob Kaplan-Moss
On 12/4/06 5:57 AM, John Lenton wrote: > The "max", "min" and other such functions might be a little more > problematic, unless groupby returned, rather than a generic iterator, > a special "queryset group" and give _it_ the max/min/etc methods. This > way it would be clear that max() returns a tu

Re: Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread John Lenton
On 12/1/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > One way to think about the problem is to consider how you would write > the documentation for it. "Django implements an object based SQL > wrapper... except for the aggregations stuff, which you will need to > know SQL to use properly"

Re: Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-01 Thread Russell Keith-Magee
On 12/2/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > > But isn't it also dangerous to code (or not code) for future cases that > may or may never come? If a non-relational database backend isn't > anywhere on the current horizon, why not code aggregates and groups to > the current usage and break

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-01 Thread Jacob Kaplan-Moss
On 12/1/06 11:40 AM, Rob Hudson wrote: >> 4 - If you search the archives (user and developer), you will find several >> discussions on aggregate functions. group_by() and having() (or >> pre-magic-removal analogs thereof) have been rejected previously on the >> grounds that the Django ORM is not i

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-01 Thread Rob Hudson
Thanks for the reply, Russell. It's obviously a lot more complex and detailed than simply adding a min() where count() is. :) A couple thoughts... > 4 - If you search the archives (user and developer), you will find several > discussions on aggregate functions. group_by() and having() (or > pr

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-01 Thread DavidA
I'd like to see this type of support in the main branch, not separated. It seems that better support for floating point is just a deficiency in Django today and the aggregation need crops up everywhere - not just in scientific applications. My needs for aggregation are simply for reporting: e.g.

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-11-30 Thread Rock
Yeah it is all coming back to me. I was unwilling to answer all of these questions and create the perfect solution (which may not exist) and therefore we don't have aggregates in Django even though I demonstrated that a straightforward implementation was possible way back when. Thanks for backing

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-11-29 Thread Russell Keith-Magee
On 11/30/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > I think for those who need aggregate data these would cover a lot of > ground. I'd be willing to work on a patch if this is considered > generally useful and we can work out what the API should look like. > > 1 - I'm agreed on the need for e

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-11-29 Thread Rock
On Nov 29, 2:30 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > I needed aggregates. (I also learned about data bubbles and redesigned > > my tables to include them as necessary. This redesign eliminated almost > > all of my needs for an aggregate function interface.)Whatsa data bubble? > >

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-11-29 Thread Jeremy Dunck
> I needed aggregates. (I also learned about data bubbles and redesigned > my tables to include them as necessary. This redesign eliminated almost > all of my needs for an aggregate function interface.) Whatsa data bubble? Google and Wikipedia don't seem to know... --~--~-~--~~-

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-11-29 Thread Rock
I created such a patch last spring during the Django sprint at PyCon. The basic interface was very straightforward but there was also a slightly less straightforward interface option that allowed for grouping and so forth. The patch was discarded, however, since some of the core Django developers