Re: Proposed Changes

2007-01-09 Thread David Cramer
http://dpaste.com/hold/4539/ I think I still have an issue with related fields that werent included in the query On Jan 10, 8:15 am, "David Cramer" <[EMAIL PROTECTED]> wrote: > Use this paste instead, I found an issue :) > > http://dpaste.com/hold/4537/ > > On Jan 10, 6:41 am, "David Cramer" <[E

Re: Proposed Changes

2007-01-09 Thread David Cramer
Use this paste instead, I found an issue :) http://dpaste.com/hold/4537/ On Jan 10, 6:41 am, "David Cramer" <[EMAIL PROTECTED]> wrote: > Alright, anyways, if someone wants to test this, it worked 100% for me, > the updated select_related(). I'm not sure if we're updated with the > latest nightly

Re: Removing SQL From Templates

2007-01-09 Thread James Bennett
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > Using full page caching, or view caching, is not an option for us on > most pages, as things vary such as moderation options. There are still plenty of ways you can make use of the cache. From what you've said, I think two in particular are wor

Django AMF supports AMF3

2007-01-09 Thread Tomohiro Otsuka
Hi all, I released new version of Django AMF. Now it supports AMF3 format which is the default serialization used for ActionScript 3.0. http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en http://djangoamf.sourceforge.jp/index.php?UserManual_en http://sourceforge.jp/projects/djangoamf/ Djang

Re: Removing SQL From Templates

2007-01-09 Thread David Cramer
Using full page caching, or view caching, is not an option for us on most pages, as things vary such as moderation options. On Jan 10, 5:26 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > > > I don't think you understand. We do not want the te

Re: Proposed Changes

2007-01-09 Thread David Cramer
Alright, anyways, if someone wants to test this, it worked 100% for me, the updated select_related(). I'm not sure if we're updated with the latest nightly but ill try to get that done today. http://dpaste.com/4536/ This replaces django/db/query.py and adds two arguments for select_related(): d

Re: Proposed Changes

2007-01-09 Thread Cliff Wells
David Cramer wrote: > While working on my select_related changes, I noticed that the db > backend was doing COUNT(*) for .count().. why? > > I've changed it on my local copy to count the id column, but unless > anyone can give me a specific reason, as far as I recall, it's faster > to just count

Re: Removing SQL From Templates

2007-01-09 Thread James Bennett
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > I don't think you understand. We do not want the template to be able to > execute any queries that have not already been done by the time it's > hit the render phase. If it hasnt been executed, we don't want it > accessible. The reason for this

Re: Proposed Changes

2007-01-09 Thread David Cramer
While working on my select_related changes, I noticed that the db backend was doing COUNT(*) for .count().. why? I've changed it on my local copy to count the id column, but unless anyone can give me a specific reason, as far as I recall, it's faster to just count on the id column. On Dec 26 200

Re: Removing SQL From Templates

2007-01-09 Thread David Cramer
I don't think you understand. We do not want the template to be able to execute any queries that have not already been done by the time it's hit the render phase. If it hasnt been executed, we don't want it accessible. The reason for this is to stop queries going outside of our cache and/or view.

Re: Removing SQL From Templates

2007-01-09 Thread James Bennett
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > I'd like to come up with an optional, or simply, a solution for our > framework, where designers do not get access to do the SQL through the > template on related attributes. Also, bear in mind that this option locks you in to the unpleasant si

Re: Removing SQL From Templates

2007-01-09 Thread James Bennett
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > I'll happily modify django for what I want, I just need some help on > where to start... as I dug around for an hour or two the other day and > couldn't see where exactly the related objects execute the lazy sql. If > nothing else, I guess I cou

Problem with Custom Form & Manipulator

2007-01-09 Thread Ritchie
I'm currently creating a web app that will create a case file for every company record, it will also create multiple contacts for a case files, below are copies of the files and views. Basically I'm developing a form that will allow a user to create a new case file and add multiple contacts at th

Re: Removing SQL From Templates

2007-01-09 Thread David Cramer
select_related is horrible slow on 90% of large database queries, and I haven't managed to implement the functionality I want in it yet. I'd like to come up with an optional, or simply, a solution for our framework, where designers do not get access to do the SQL through the template on related a

Re: sorting the results of a queryset

2007-01-09 Thread Brian Beck
Robert Slotboom wrote: > > sorted(Category.objects.all(), key=Category.get_absolute_url) > > This is a very nice approach! > Although, shouldn't these "get_absolute_url" calls be followed by () ? Nope! Python will call it for you. The good thing is it will only call it once per item instead of on

Re: Removing SQL from Templates

2007-01-09 Thread reinmar
reinmar wrote: > Hi David, > This sounds truly disturbing. Can you give an example of how your > templates execute SQL queries? That would help in giving specific > advice. David, Ignore that, I missed the discussion at the duplicate post http://groups.google.com/group/django-users/browse_threa

Importing models from outside applications

2007-01-09 Thread johnnie pittman
I've done a good amount of searching the archives and the wiki on the site looking for the answer to this question. If this has already been answered, please accept my apology for repeating the question and please point me to the answer. I'm looking to find out if there's a method to access djang

Re: Removing SQL from Templates

2007-01-09 Thread reinmar
Hi David, This sounds truly disturbing. Can you give an example of how your templates execute SQL queries? That would help in giving specific advice. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Re: Running Django on OpenBSD...best practices?

2007-01-09 Thread johnnie pittman
On 1/9/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > Any suggestions for which direction I should pursue? (Building > Apache2 + building mod_python) Options I haven't uncovered? I went this route under OpenBSD 3.9 and have had very few issues. The most trouble I had was with getting mod_pytho

Re: sorting the results of a queryset

2007-01-09 Thread Robert Slotboom
Hi Brian, Of course the parenthesis... I'll this fix tomorrow. > sorted(Category.objects.all(), key=Category.get_absolute_url) This is a very nice approach! Although, shouldn't these "get_absolute_url" calls be followed by () ? Thank's Rob > > Rob Slotboom wrote: >> in the model class: >>

Re: Running Django on OpenBSD...best practices?

2007-01-09 Thread Guillermo Fernandez Castellanos
Hi, Another option that has been considered by more and more people is Nginx. This page it's in polish, but the configuration files are pretty understandable: http://www.python.rk.edu.pl/w/p/django-pod-serwerem-nginx/ A podcast is here: http://mx.bw.rulez-forever.com/Django-Nginx-FastCGI-screenca

Re: How can I display the user-friendly version of my field with choices ?

2007-01-09 Thread James Bennett
On 1/9/07, Chris Brand <[EMAIL PROTECTED]> wrote: > Presumably I can also use that in a template : > {% object.get_kind_display %} Yup. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received t

RE: How can I display the user-friendly version of my field with choices ?

2007-01-09 Thread Chris Brand
> Each instance of your model will have a special method name > 'get_foo_display', where 'foo' is the name of the field with the > choices. For example: I should have found that. Thanks. > >>> b.get_kind_display() Presumably I can also use that in a template : {% object.get_kind_display %} Chr

Running Django on OpenBSD...best practices?

2007-01-09 Thread Tim Chase
I'm setting up an OpenBSD server and would like to start testing some projects using Django. Are there any bits of sage advice that could be given? At this point, I'm not tied to anything else (Apache vs. Lighttpd; mod_python vs. WSGI; etc). Some of the speedbumps that I've come across in my

Re: How can I display the user-friendly version of my field with choices ?

2007-01-09 Thread James Bennett
On 1/9/07, Chris Brand <[EMAIL PROTECTED]> wrote: > In the admin, it displays the current value nicely (the second column), but > on my page, it displays the actual value from the database (the first > column) instead. I'd like to display the value used by the admin form, but > can't figure where

form_for_model and default values

2007-01-09 Thread Rodrigo Lazo
Hi everybody, I'm newbie at django but I think is awesome. I use newforms and I had two questions: 1) I have a model with a FileField so everything at the admin interface works fine, but when I get the form using form_for_model the widget isn't a FileInput(). Is this the right behaviour? or it's

Convert From Restructured Text to HTML

2007-01-09 Thread Stephen Mizell
In our database we have a TextField that stores the body of our posts in RestructuredText. I've recently added TinyMCE to the Django Admin, so I'm wanting to convert this field from rst to plain old html. I wrote a little thing of code to do this with Django. def convert_post(request):

How can I display the user-friendly version of my field with choices ?

2007-01-09 Thread Chris Brand
I have model with field with choices set, similar to that in the documentation at http://www.djangoproject.com/documentation/model_api/#choices In the admin, it displays the current value nicely (the second column), but on my page, it displays the actual value from the database (the first column)

Re: Underscore in CharField definition

2007-01-09 Thread Waylan Limberg
On 1/9/07, chasfs <[EMAIL PROTECTED]> wrote: > > I was looking at django.contrib.auth.models and noticed _ in front of > the first parameter, e.g. > first_name = models.CharField(_('first name'), maxlength=30, > blank=True) > > What does that mean/do? > See line 5 of that file: from

Re: Removing SQL From Templates

2007-01-09 Thread James Bennett
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > I want to setup some kind of blocking mechanism so that while rendering > a template the models will not do any SQL queries that have not already > been executed, or at least block the related field queries. Unfortunately I think this would be

Re: sorting the results of a queryset

2007-01-09 Thread Brian Beck
Rob Slotboom wrote: > in the model class: >def __cmp__(self, other): >return cmp(self.get_absolute_url, other.get_absolute_url) > > In a function: >cat_list = [] >for cat in Category.objects.all(): > cat_list.append(cat) >cat_list.sort() Hi Rob, I think the problem

Underscore in CharField definition

2007-01-09 Thread chasfs
I was looking at django.contrib.auth.models and noticed _ in front of the first parameter, e.g. first_name = models.CharField(_('first name'), maxlength=30, blank=True) What does that mean/do? Thanks! --~--~-~--~~~---~--~~ You received this message because

Admin change_list special feature lost when I customize the view

2007-01-09 Thread Picio
Hello, I need to filter the results of my admin change_list page. Following Chapter 18 of the wonderfull djangobook I managed to build my Custom View for a change_list page. Unfortunately I lost all the pretty things like, the search field, date hierarchy, filter per day month, etc. These are my s

Re: close database connection ?

2007-01-09 Thread Jeremy Dunck
On 1/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm just getting data from the database in the following way. > > info.antiigm_set.values() OK, that narrows it down. ;-) Also, are you running on trunk or some other version of Django? > The application is running on a linux server coul

Re: admin > custom error message

2007-01-09 Thread Robert Slotboom
Hi James, > You don't need to write a manipulator; just write a validator > function, and put it in the validator_list for that field on the > model. Django will handle calling the validator for you any time one > of the "automatic" manipulators (e.g., in the admin) gets used. > Ok I got it work

Re: Get time of last visit

2007-01-09 Thread [EMAIL PROTECTED]
Could someone elaborate on updating last_login or otherwise making it more usable? Time between logins can be much longer than when they were actually last seen. Currently I have a middleware solution that's not really working at all. --~--~-~--~~~---~--~~ You re

Re: License Terms

2007-01-09 Thread Rex
Thanks for the insight! Though I myself like to have new development open to the community, my client insists that he own the code, I have no choice. I wish to us django in a big way and delight him :) On Jan 7, 4:45 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 1/6/07, Rex <[EMAIL PROTECT

Re: dynamic newforms in a template

2007-01-09 Thread gkelly
I can't use {{ form.field_name }} because the field_name is the dynamic part. The form is generated by a database configuration and I won't know ahead of time which fields will need to be in the form. I imagine django would make it easy to do something like this, since the admin interface also req

Re: admin > custom error message

2007-01-09 Thread James Bennett
On 1/9/07, Rob Slotboom <[EMAIL PROTECTED]> wrote: > Of course this wil not work because class "HasUniquePath" isn't a > manupulator. > I dont know however how to extend the object's manipulators. You don't need to write a manipulator; just write a validator function, and put it in the validator_

Re: Removing SQL From Templates

2007-01-09 Thread Waylan Limberg
On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote: > > I'm talking completely about the related objects accessors, and not > sending models to the templates is not a good solution for us :) > > I want to setup some kind of blocking mechanism so that while rendering > a template the models will not

sorting the results of a queryset

2007-01-09 Thread Rob Slotboom
My model uses a single table parent-child relationship. I got the parent representation working but I isn't sorted right. So I tried to sort the list of objects, returned by objects.all() in the model class: def __cmp__(self, other): return cmp(self.get_absolute_url, other.get_absolute_

Re: close database connection ?

2007-01-09 Thread [EMAIL PROTECTED]
Hello, I'm just getting data from the database in the following way. info.antiigm_set.values() The application is running on a linux server could that be the problem ? Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Mod_python error: "PythonHandler django.core.handlers.modpython"

2007-01-09 Thread temnoregg
Apache version Apache Apache threaded MPM No (single thread MPM) Apache forked MPM Yes, maximum 256 processes Apache server root /usr/local/apache2 Apache document root/home/hosting/kolokolo_beta/subdomains/bikeshop Apache error log/home/hosting/kolokolo_beta/logs/error

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
Hmm, I wrote this in my models.py. Errors rased are just for debugging. class HasUniquePath(object): def __init__(self, cat_obj, error_message=gettext_lazy("No unique path!")): self.cur_cat = cat_obj self.error_message = error_message self.always_test = True def __call__

Re: Mod_python error: "PythonHandler django.core.handlers.modpython"

2007-01-09 Thread mtnpaul
Are they both installed into the same python version? Maybe you installed Django into python 2.4, and mod_python into python 2.5 (at least it appears to be in 2.5). From what I looked at I thought django was best installed in 2.4 (sorry, I don't recall where I saw that). Of course then mod_python

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
Thanks James, I'll try this one def IsUniqueForPath(): ... class Category(models.Model): ... parent = models.ForeignKey('self', blank=True, null=True, related_name='child_set', validator_list=[IsUniqueForPath]) --~--~-~--~~~---~--~~ You received this message

Re: Inner Join

2007-01-09 Thread Russell Keith-Magee
On 1/9/07, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > > Russell Keith-Magee wrote: > > table1.objects.filter(table2_attribute_name.field='foo') > > Did you mean > > table1.objects.filter(table2_attribute_name__field='foo') > > > (i.e. '__' instead of '.')? Bah. Yes, of course. Brain shutdown

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
Hi James, When I write a custom validator like: isValidCategory() I need a manipulator, validator and a form. Is there a way to use the 'current' ones and to expand these or do I need to create them from scratch? --~--~-~--~~~---~--~~ You received this message b