Re: Database connection closed after each request?

2009-07-24 Thread Andy
On Jul 24, 8:54 pm, Alex Gaynor wrote: > "Seen under this light, the additional 150ms latency resulting from non- > persistent DB connection is huge - it implies almost 30% fewer > customer orders. And it has nothing to do with traffic." > > I'd just like to take a moment

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 7:55 PM, Glenn Maynard wrote: > There are lots of requests for ways to build specific types of > queries, too.  You can't really commit a QuerySet method for one thing > and then... So, let's walk through this logically. Suppose we start with a patch

Re: Database connection closed after each request?

2009-07-24 Thread Glenn Maynard
On Fri, Jul 24, 2009 at 8:36 PM, Andy wrote: > Seen under this light, the additional 150ms latency resulting from non- > persistent DB connection is huge - it implies almost 30% fewer > customer orders. And it has nothing to do with traffic. By the way, I switched my

Re: Database connection closed after each request?

2009-07-24 Thread Glenn Maynard
On Fri, Jul 24, 2009 at 8:17 PM, James Bennett wrote: > While the specific thing you personally are asking for might not be > that much, we can't really commit it to Django and then say "Hey, we > only did this for Glenn and nobody else gets to ask for features > building

Re: Database connection closed after each request?

2009-07-24 Thread Alex Gaynor
On Fri, Jul 24, 2009 at 8:36 PM, Andy wrote: > > On Jul 24, 4:39 pm, James Bennett wrote: >> Except this is what it turns into. So suppose a patch is added which >> does nothing except keep the database connection open; well, that's >> problematic

Signals API

2009-07-24 Thread Glenn Maynard
Is the Signals API public? There's http://docs.djangoproject.com/en/dev/topics/signals/, which explains connecting to signals (so Signal.connect is public), but the rest of Signal, eg. Signal.disconnect, doesn't seem to be in there anywhere. Google can't find the Signal.disconnect docstring

Re: Database connection closed after each request?

2009-07-24 Thread Andy
On Jul 23, 10:50 pm, Glenn Maynard wrote: > In this case, that's a terrible-performance-by-default approach. > (It's also not a default, but the only behavior, but I'll probably > submit a patch to add a setting for this if I don't hit any major > problems.) Agreed. Please

Re: Database connection closed after each request?

2009-07-24 Thread Andy
On Jul 24, 4:39 pm, James Bennett wrote: > Except this is what it turns into. So suppose a patch is added which > does nothing except keep the database connection open; well, that's > problematic because it means a server process/thread that's not > handling a request at

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 7:03 PM, Glenn Maynard wrote: > What I need is sensible, simple and faster, but since someone else > might want to turn it into something complex and unnecessary, it > shouldn't be done? While the specific thing you personally are asking for might not be

Re: Database connection closed after each request?

2009-07-24 Thread Glenn Maynard
On Fri, Jul 24, 2009 at 4:39 PM, James Bennett wrote: > Except this is what it turns into. So suppose a patch is added which > does nothing except keep the database connection open; well, that's > problematic because it means a server process/thread that's not > handling a

Re: How to create this filter

2009-07-24 Thread David
I used this syntax .extra(where=['%s >= %s - %s'], params=['criteria1_metric1', 'criteria1_metric2', 'criteria1_value']) however I got error. On Jul 24, 4:16 pm, David wrote: > Here comes a new problem. I do not know which columns' values to use; > all I know is that they

Re: How to create this filter

2009-07-24 Thread David
Here comes a new problem. I do not know which columns' values to use; all I know is that they are represented with variables. These variables are col_var_1, condition_operator, col_var_2, manipulation_operator, constant_value where: col_var_1: col1, or col2, or col3, etc condition_operator: >,

Re: Where are the admin app icons from?

2009-07-24 Thread Alex Gaynor
On Fri, Jul 24, 2009 at 5:12 PM, Margie wrote: > > Hi, > > I'm wondering if the icons in the admin app (for example, the > addlink.gif icon) come from some standard icon (free) icon package > where there are more goodies of the same sort?  Anyone have any > pointers for

Re: How to create this filter

2009-07-24 Thread David
Great. I go to pick up extra() to use. Thanks Tim. On Jul 24, 2:33 pm, Tim Chase wrote: > > Such a transformation is fine. I found that my Django has no F(). > > Checking the Django doc I saw that this new feature is "New in Django > > Development version". >

Re: How to create this filter

2009-07-24 Thread Tim Chase
> Such a transformation is fine. I found that my Django has no F(). > Checking the Django doc I saw that this new feature is "New in Django > Development version". > > So I have to wait for the new version? Are there any other ways to > create such a filter? >> col1_value >= col2_value * 2 >>

Re: How to create this filter

2009-07-24 Thread David
Such a transformation is fine. I found that my Django has no F(). Checking the Django doc I saw that this new feature is "New in Django Development version". So I have to wait for the new version? Are there any other ways to create such a filter? Any ideas? Thanks again. On Jul 24, 2:01 pm,

Where are the admin app icons from?

2009-07-24 Thread Margie
Hi, I'm wondering if the icons in the admin app (for example, the addlink.gif icon) come from some standard icon (free) icon package where there are more goodies of the same sort? Anyone have any pointers for where those came from? Margie --~--~-~--~~~---~--~~

Model Formsets Have an Extra Blank Form?

2009-07-24 Thread derek
I'm following the instructions here: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ But when I do this kind of thing: formset = AuthorFormSet(queryset=Author.objects.filter (name__startswith='O')) I always get an extra blank form at the end of my formset - regardless of how I

Re: How to create this filter

2009-07-24 Thread Frédéric Hébert
It seems to me that you have to transform your fields lookup like that : col1_value >= col2_value * 2 something like col1__gte=F('col2') * 2 Frédéric 2009/7/24 David : > > Hello, > > Here is a table "myTable" with columns of "col1", "col2", "col3", ..., > "col5". The types

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 1:31 AM, Glenn Maynard wrote: > I see no need for a complex connection pooling service.  You're making > this sound much more complicated than it is, resulting in people > needing to use configurations much more complicated than necessary. Except this is

Re: Middleware that injects data for template

2009-07-24 Thread Tim Chase
Stodge wrote: > Say I want to inject a piece of data into every page view. For > now, let's just say I want to inject the current time into > each page view. I write a piece of middleware that will do it. > But how? Do I modify the request? Or the view (process_view)? I understand that this

Middleware that injects data for template

2009-07-24 Thread Stodge
Say I want to inject a piece of data into every page view. For now, let's just say I want to inject the current time into each page view. I write a piece of middleware that will do it. But how? Do I modify the request? Or the view (process_view)?

How to create this filter

2009-07-24 Thread David
Hello, Here is a table "myTable" with columns of "col1", "col2", "col3", ..., "col5". The types of these columns are all float. Now for two values from any two columns of these columns, I may need to add, or subtract, or multiply or divide these two values. With this result, I do a condition

Re: Following part 2 of the tutorial, I get the following error when trying to view /admin/:

2009-07-24 Thread Amit Sethi
On Fri, Jul 24, 2009 at 6:04 PM, ashish wrote: Well as your error message says , Template does not exist my first guess would be that you did not Activate the admin site .. if that is not so , you should have a look at the section , Customize the look and feel of admin ... it

Re: How to tell if a fields was modified

2009-07-24 Thread ankit rai
use clean method and use self.instance.fieldname to know previous value and then compare with the new value. On Fri, Jul 24, 2009 at 10:50 PM, Tim Chase wrote: > > >> How can I tell which model fields have been modified (this is, the > >> difference between the

Best way to render 1-to-many relationship in a template

2009-07-24 Thread SweetPete
Hi, Python/Django newb here. I have a question regarding the best approach to rendering 1-to-many relationships in a template. I have 2 tables, Customers and Cars, where a Customer can have many Cars, hence the 1-to-many relationship. I need to display all the Customers with all their Cars,

Re: html text field ...disabled in form?

2009-07-24 Thread Jacob Kaplan-Moss
On Fri, Jul 24, 2009 at 8:57 AM, Asinox wrote: > how ill make a html text field with attr disabled? See the ``attrs`` argument to widgets: http://docs.djangoproject.com/en/dev/ref/forms/widgets/#customizing-widget-instances Jacob

Re: ImageFile bug? (Re: ImageField questions)

2009-07-24 Thread Jacob Kaplan-Moss
On Fri, Jul 24, 2009 at 8:23 AM, Rusty Greer wrote: > from what i can tell, get_image_dimensions in > django/core/files/images.py seems to open the files but never closes > them.  is this a bug? Yes, it was #8817 (http://code.djangoproject.com/ticket/8817) which was fixed a few

Re: Slugs, why would you ever need to store one in the database?

2009-07-24 Thread Andy Mikhailenko
Just one more addition to the replies above: there's a number of snippets[1], recipes and packages[2] which introduce purely autogenerated safe (unique and sometimes also non-ascii-friendly) slugs without using admin. Autopopulated slugs, when used in URLs without exposing internal

Re: How to tell if a fields was modified

2009-07-24 Thread Randy Barlow
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matias declared: > How can I tell which model fields have been modified (this is, the > difference between the Model instance and the data originally retrieved > from the database) from inside the model's save() method? You can always retrieve the

How to tell if a fields was modified

2009-07-24 Thread Matias
Hi, How can I tell which model fields have been modified (this is, the difference between the Model instance and the data originally retrieved from the database) from inside the model's save() method? Any idea? Thanks a lot! --~--~-~--~~~---~--~~ You

html text field ...disabled in form?

2009-07-24 Thread Asinox
hi, guys, how ill make a html text field with attr disabled? Thanks --~--~-~--~~~---~--~~ 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

Re: problem with forms, ForeignKey, get_or_create

2009-07-24 Thread Nail
> Have you tried the save_formset of the ModelAdmin? > http://docs.djangoproject.com/en/dev/ref/contrib/admin/ No, i am trying to create user view, not admin. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

ImageFile bug? (Re: ImageField questions)

2009-07-24 Thread Rusty Greer
On Thu, Jul 23, 2009 at 5:55 PM, Joshua Russo wrote: > On Thu, Jul 23, 2009 at 9:31 PM, Rusty Greer wrote: >> >> how do i create a query on the size of an image? >> >> for example: >> class Image(models.Model): >> >>    image =

Re: A confusing traceback.

2009-07-24 Thread Daniel Roseman
On Jul 24, 3:13 pm, cornjuliox wrote: > File "C:\Blog2\..\Blog2\Engine2\models.py" in save >   48.         super(Entry).save() > > Exception Type: AttributeError at /admin_add/ > Exception Value: 'super' object has no attribute 'save' > > Am I not supposed to be using

Re: Django, multiple domains, multiple locales/languages

2009-07-24 Thread Joshua Russo
I ran into some conceptual problems with lazy vs non-lazy too. Any global context needs to be lazy. This includes everything declared outside of any function or class context and the class instance variable declarations (tho not the declarations made in __init__ or __new__ of a class) On Fri, Jul

Re: Admin - related objects when using multiple foreign keys to a parent model

2009-07-24 Thread Haestan
-- From: "Karen Tracey" Sent: Friday, July 24, 2009 3:16 PM To: Subject: Re: Admin - related objects when using multiple foreign keys to a parent model > On Fri, Jul 24, 2009 at 9:02 AM,

Re: problem with forms, ForeignKey, get_or_create

2009-07-24 Thread Joshua Russo
On Thu, Jul 23, 2009 at 10:53 PM, Nail wrote: > > Hello, developers! > > Please help me with one problem. I spent 2 days attempting to solve > it. And now i have some solution, but i don't like it. > > My application manages music tracks. > There is models: Artist, Album,

A confusing traceback.

2009-07-24 Thread cornjuliox
Could someone lend a hand? Instead of using the built-in admin interface, I'm trying to build an 'admin page' of my own using ModelForms, but the problem is that the SlugField won't prepopulate like it does with the default admin so I've resorted to overriding the save() method and including a

Re: Admin - related objects when using multiple foreign keys to a parent model

2009-07-24 Thread Karen Tracey
On Fri, Jul 24, 2009 at 9:02 AM, Haestan wrote: > > Hi, > > let's assume the following simple model: > > class Child(models.Model): >father = models.ForeignKey(Adult, related_name="father") >mother = models.ForeignKey(Adult, related_name="mother") > > class

Admin - related objects when using multiple foreign keys to a parent model

2009-07-24 Thread Haestan
Hi, let's assume the following simple model: class Child(models.Model): father = models.ForeignKey(Adult, related_name="father") mother = models.ForeignKey(Adult, related_name="mother") class Adult(models.Model): name = models.CharField(max_length=255) Now, if I try to delete an

Re: Please help me design Model

2009-07-24 Thread urosh
Thank you Emily For pointing me to right direction. On Jul 24, 11:41 am, Emily Rodgers wrote: > On Jul 23, 11:06 pm, urosh wrote: > > > > > Hi. > > > I want to create phone book. I want that this phone book list will be > > ordered by

Strange error saving in admin

2009-07-24 Thread Julien Phalip
Hi, I've got a really strange error on one of my sites. There is an Organisation model which has a dozen of fields and 1,300 rows. Saving organisation details in the admin usually works fine except for one organisation. When I click 'Save', the page loads for ever and then it fails with a 502

Tutorial 3 templates

2009-07-24 Thread Timbadu
Hi folks, I'm working throu the Django Tutorials and am on no. 3. No matter where I put my 404.html and 500.html template files I am always getting this traceback: Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\servers \basehttp.py", line 278, in run

Re: Django, multiple domains, multiple locales/languages

2009-07-24 Thread MS
OK, thanks for suggestion - however it seems the problem was somewhere else - I was using ugettext where ugettext_lazy was supposed to be used (ex. in forms.py). The documentation should be more clear that the choice between ugettext and ugettext_lazy is quite important and may lead to strange

Re: which version of django should I choose?

2009-07-24 Thread Ronghui Yu
In my opinion, every version is good for learning. Just try it. And if you encounter difficuties for upgrading to another one, you will learn a lot from it. XUN ZHOU 写道: > hello, I am new beginner in django. I want to learn python with django > and later I want to write my first application

Re: which version of django should I choose?

2009-07-24 Thread Russell Keith-Magee
On Fri, Jul 24, 2009 at 6:32 PM, Kenneth Gonsalves wrote: > > On Friday 24 Jul 2009 2:59:29 pm XUN ZHOU wrote: >> hello, I am new beginner in django. I want to learn python with django and >> later I want to write my first application in google App engine. >> there are so

Re: which version of django should I choose?

2009-07-24 Thread Kenneth Gonsalves
On Friday 24 Jul 2009 2:59:29 pm XUN ZHOU wrote: > hello, I am new beginner in django. I want to learn python with django and > later I want to write my first application in google App engine. > there are so many different version of django. > which version should I beginn? thanks your help or

which version of django should I choose?

2009-07-24 Thread XUN ZHOU
hello, I am new beginner in django. I want to learn python with django and later I want to write my first application in google App engine. there are so many different version of django. which version should I beginn? thanks your help or advice -- Xun Zhou TU Berlin

Re: Please help me design Model

2009-07-24 Thread Emily Rodgers
On Jul 23, 11:06 pm, urosh wrote: > Hi. > > I want to create phone book. I want that this phone book list will be > ordered by number of dialing this number. I think of using two tables > one with phone numbers and one for phone dialing statistics (how many > times user

Django, multiple domains, multiple locales/languages

2009-07-24 Thread MS
Hi, I have a problem with Django - I'm trying to build a website which will work on a couple of different domains and each domain should have a different language/locale. Example: domain.com -> English domain2.pl -> Polish The SITE_ID should change accordingly when I visit the corresponding

Re: forms with django and extjs 3.0.0

2009-07-24 Thread Emily Rodgers
2009/7/24 Russell Keith-Magee : > > On Thu, Jul 23, 2009 at 5:43 PM, Emily > Rodgers wrote: >> >> Hi all, >> >> I am currently working on some web apps that use django for the back >> end, and extjs for the front end (using JSON to pass

Re: view/form with fields from multiple models

2009-07-24 Thread Matthias Kestenholz
On Fri, Jul 24, 2009 at 10:46 AM, Benjamin Wohlwend wrote: > > On Jul 24, 10:37 am, Benjamin  Wohlwend wrote: > >> >> if all(f.is_valid() for f in (form1, form2, form3)): >>     # ok, save >> > > Oops, forgot to mention that I had to implement my own

Returning pretty pages with 410 status code

2009-07-24 Thread Metin Amiroff
Hello everyone! I was wondering what technique people use to return pretty pages with 410 status code (ResponseGone) since search engines keep coming back for removed pages that return 404. I currently use something like this, but maybe someone has come up with a nicer shortcut or

Re: view/form with fields from multiple models

2009-07-24 Thread Benjamin Wohlwend
On Jul 24, 10:37 am, Benjamin Wohlwend wrote: > > if all(f.is_valid() for f in (form1, form2, form3)): >     # ok, save > Oops, forgot to mention that I had to implement my own version of all (), which doesn't short cut: def really_all(iter): all_true = True for

Re: view/form with fields from multiple models

2009-07-24 Thread Benjamin Wohlwend
Hi, On Jul 24, 8:41 am, Matthias Kestenholz wrote: > if request.method == 'POST': >     # initialize forms with request.POST and prefix >     if form1.is_valid() and form2.is_valid() and form3.is_valid(): >         # save the data from the individual forms >

Re: pdb session and auto-reload: input problem

2009-07-24 Thread Jeremy Sule
Thank you for your help. Now I don't have to restart the terminal again. I still have to interrupt django though. But it's better than before. I whish Django would just interrupt the session by itself. Toutanc On Thu, Jul 23, 2009 at 3:00 PM, Tom Evans wrote: > > On

Re: cross-referencing design question

2009-07-24 Thread Daniel Roseman
On Jul 24, 5:46 am, Mike Dewhirst wrote: > I'm new to Django and want to express a self-referencing design > feature to link clients in the same table with each other. Django is > currently objecting to this. Could you please point me to > documentation which will let me

Re: Admin Customisations

2009-07-24 Thread Daniel Roseman
On Jul 24, 8:27 am, StevenC wrote: > Hey, > > Im new to Django and have create an online application system. > > I need to know is it possible to customise the List Display and have a > customn link next to EVERY entry which points to a nother URL with its > ID within. > >

Admin Customisations

2009-07-24 Thread StevenC
Hey, Im new to Django and have create an online application system. I need to know is it possible to customise the List Display and have a customn link next to EVERY entry which points to a nother URL with its ID within. For example, If i have a student application. Their ID being 1. I need a