pre_save() function -- feature request

2005-12-12 Thread Ian Holsman
is it possible to pass the actual object to it as well as the new data? I want to something like 'slugify' but only if it is a new record, and pre-save doesn't have enough information in it for me to do this ;( -- [EMAIL PROTECTED] -- blog: http://feh.holsman.net/ -- PH: ++61-3-9877-0909 If ev

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread oggie rob
Okay. Sorry that wasn't intuitive to me. -rob

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
oggie rob wrote: > Right, but what good is overriding len(..) if you have the list > already? You've already fetched the records, right? > As Jacob said before, when you say "get_article_count", you know that > you are actually executing an SQL query. What is the case when you say > reporter.artic

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread oggie rob
Right, but what good is overriding len(..) if you have the list already? You've already fetched the records, right? As Jacob said before, when you say "get_article_count", you know that you are actually executing an SQL query. What is the case when you say reporter.articles? Is this a list already

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
Jacob Kaplan-Moss wrote: > > Hey folks -- > I understand your point about changing code, it is a big irritation. I was thinking that it *might* be possible to have something which optionally adds back the current methods. API changes are always annoying. Unfortunately back-compat is often even

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
oggie rob wrote: > The "len" idea is not great anyway - it is much more costly to get and > len 10,000 rows than to use SQL count, as get_article_count does. > > -rob > > Erm, you have heard of __len__, right?

Re: Django Ajax Redux

2005-12-12 Thread Steven Armstrong
On 12/12/05 01:15, Lachlan Cannon wrote: Using classes it's not clear if it's there to style an element or to pass params to some js widget or whatever. When using custom attrs it's much clearer what's going on. I couldn't disagree more. :) class is there to 'subclass' elements. The W3C them

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > I think all in all it's a good idea, but I do have one big objection: > one of the things that's always bugged me about ORMs is that they > shield you from knowing when you're hitting the database. This sucks > when it comes time to opti

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, oggie rob <[EMAIL PROTECTED]> wrote: > The "len" idea is not great anyway - it is much more costly to get and > len 10,000 rows than to use SQL count, as get_article_count does. I would hope that the __len__ method would be implemented as something that does an SQL count. -- "May t

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread oggie rob
The "len" idea is not great anyway - it is much more costly to get and len 10,000 rows than to use SQL count, as get_article_count does. -rob

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Jacob Kaplan-Moss
Hey folks -- I've been thinking about this proposal for a while... First, in the interest of full disclosure I've got to say that's it's difficult to accept something like this knowing that I'll need to change thousands of lines of code... I'll try to set that aside, though. I think all

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
James Bennett wrote: > On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > >>Ie. verbose_name_plural defines the name for code (object instances)? Based >>on the tutorial I thought it is mostly used for admin presentation texts. > > > Well, in part I misspoke. What you want is both module_nam

Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
Adrian Holovaty wrote: > On 12/12/05, Robert Wittams <[EMAIL PROTECTED]> wrote: > >>class Reporter(meta.Model): >> articles = meta.Collection('Article','reporter') >> >>class Articles(meta.Model): >> reporter = meta.ForeignKey(Article) > > > This gets a huge -1 from me. Only one end of the

Re: pluralization - was Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > Ie. verbose_name_plural defines the name for code (object instances)? Based > on the tutorial I thought it is mostly used for admin presentation texts. Well, in part I misspoke. What you want is both module_name and verbose_name_plural. -- "

pluralization - was Re: Descriptors for fields?

2005-12-12 Thread Radek Svarz
Ie. verbose_name_plural defines the name for code (object instances)? Based on the tutorial I thought it is mostly used for admin presentation texts. Radek On 12/12/05, James Bennett <[EMAIL PROTECTED]> wrote: On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote:> the issue is, how do you define the

Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > the issue is, how do you define the pluralization. just adding s at the end > works only in some cases and does not usually work in other languages. (eg. > in Czech: class Anketa - plural is ankety not anketas) Currently, with verbose_name_pl

Re: Descriptors for fields?

2005-12-12 Thread Radek Svarz
the issue is, how do you define the pluralization. just adding s at the end works only in some cases and does not  usually work in other languages. (eg. in Czech: class Anketa - plural is ankety not anketas) you can imagine it with class Money() (I know, it's not very good example - we usually say

Re: Descriptors for fields?

2005-12-12 Thread Adrian Holovaty
On 12/12/05, Robert Wittams <[EMAIL PROTECTED]> wrote: > class Reporter(meta.Model): >articles = meta.Collection('Article','reporter') > > class Articles(meta.Model): >reporter = meta.ForeignKey(Article) This gets a huge -1 from me. Only one end of the relationship should need to be defin

Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > so I think it should be either: > 1. >reporter.article.add(...) >article.reporter.id > > or: > 2. >reporter.articles.add(...) >articles.reporter.id > To me, the pluralization makes sense; a reporter has many articles, so 'a

Re: Descriptors for fields?

2005-12-12 Thread Radek Svarz
I am fine with verbose_name etc. I meant pluralization in the code. I was confused with reporter (singular) and articles (plural, which I thought was based on class Article - singular) and thought you want to create lists based on autogenerated plural. => reporter.articles you can see it here: >>

Re: Descriptors for fields?

2005-12-12 Thread Robert Wittams
James Bennett wrote: > On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > >>very nice proposal. but please avoid pluralization. it is very odd in other >>languages than English. > > > I think pluralization is something to be dealt with elsewhere; so long > as this takes advantage of module_n

Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/12/05, Radek Svarz <[EMAIL PROTECTED]> wrote: > very nice proposal. but please avoid pluralization. it is very odd in other > languages than English. I think pluralization is something to be dealt with elsewhere; so long as this takes advantage of module_name, verbose_name and/or verbose_na

Re: Descriptors for fields?

2005-12-12 Thread Radek Svarz
very nice proposal. but please avoid pluralization. it is very odd in other languages than English. RadekOn 12/12/05, James Bennett <[EMAIL PROTECTED]> wrote: On 12/11/05, Robert Wittams <[EMAIL PROTECTED]> wrote:> Its pretty orthogonal to most of the other suggestions.Yeah, but as proposed lookup

Re: Descriptors for fields?

2005-12-12 Thread James Bennett
On 12/11/05, Robert Wittams <[EMAIL PROTECTED]> wrote: > Its pretty orthogonal to most of the other suggestions. Yeah, but as proposed lookup syntaxes go, this one is by far the best. And implementing special methods like __len__ would make it just about perfect, IMHO; the closer we can get to mo