Re: Controlling form/widgets output

2009-01-21 Thread Mike Amy
The FormRenderer idea is a good one. But how about generalised Renderer objects that take or inherit a template list, build a context and then can be passed around to fill in the details. Update-able at construction, processing or rendering, and able to be passed straight into another context for

Re: Controlling form/widgets output

2009-01-21 Thread catsclaw
On Jan 21, 7:20 pm, Malcolm Tredinnick wrote: > In the larger scheme, I think this is one of those areas where people's > initial intuition differs. Django's form classes generally push > downwards, with the greater intelligence lying at the higher levels > (forms know the most, then form field c

Re: Controlling form/widgets output

2009-01-21 Thread Jacob Kaplan-Moss
On Thu, Jan 22, 2009 at 4:57 PM, catsclaw wrote: > Well, it seems to me that makes for an *extremely* tight coupling > between the model and the view. I'm sorry to be so blunt, but your perception is misguided. Forms have no dependancy upon models, nor do models on forms, nor must views use fo

Re: Controlling form/widgets output

2009-01-21 Thread catsclaw
On Jan 21, 5:37 pm, Russell Keith-Magee wrote: > >   Here's just one example: when fields are written out to HTML, they > > get asked "what attributes does this kind of widget need?". > > Unless I'm misunderstanding your intent with this statement - No, they > aren't. A form contains fields, whic

Re: Controlling form/widgets output

2009-01-21 Thread Malcolm Tredinnick
On Thu, 2009-01-22 at 08:37 +0900, Russell Keith-Magee wrote: > On Thu, Jan 22, 2009 at 7:39 AM, catsclaw wrote: [...] > > Adding a > > widget therefore requires rewriting the field classes you want the > > widget to be used with, rather than letting the widget interrogate the > > field classes.

Re: Controlling form/widgets output

2009-01-21 Thread Russell Keith-Magee
On Thu, Jan 22, 2009 at 7:39 AM, catsclaw wrote: > > Hi all -- > > I've started to poke around in customizing the generated form code > and providing my own widget instances, but the current Django form > code is written in such a way that it makes things nearly impossible. First off - as a ge

Controlling form/widgets output

2009-01-21 Thread catsclaw
Hi all -- I've started to poke around in customizing the generated form code and providing my own widget instances, but the current Django form code is written in such a way that it makes things nearly impossible. Here's just one example: when fields are written out to HTML, they get asked

ManyToManyField in both models/forms

2009-01-21 Thread Evgeniy Ivanov (powerfox)
Hi list, I had to implement M2M editing in both admin forms (something like editing userlist for group and grouplist for user). I wasn't able to find any fine solution, but specifying M2M in both models and creating tables manually (since syncdb tries to create two tables). I herd in the IRC, that

Re: Token parsing

2009-01-21 Thread Jacob Kaplan-Moss
On Thu, Jan 22, 2009 at 3:58 AM, Peter2108 wrote: > Not quite sure if this is the place to post this. Anyway, in the > module template.loader.tags the do_extends function parses a tokens > content like this:bits = token.contents.split() which does not > work correctly if the > extends path h

Token parsing

2009-01-21 Thread Peter2108
Not quite sure if this is the place to post this. Anyway, in the module template.loader.tags the do_extends function parses a tokens content like this:bits = token.contents.split() which does not work correctly if the extends path has a folder name with a space in it (as one of mine did). I r

Re: Joins and aggregates

2009-01-21 Thread Alex Gaynor
On Wed, Jan 21, 2009 at 9:01 AM, Ludvig Ericson wrote: > > On Jan 21, 2009, at 14:10, Russell Keith-Magee wrote: > > Any opinions? Any other options that I may have missed? > > Sorry if I'm stating the obvious, but would it be > impossible to error out if two aggregates cause this > unexpected beh

Re: Joins and aggregates

2009-01-21 Thread Tim Chase
>> 1) Prevent joins at the query level. Keep track of the joins >> that are being used for aggregates, and only allow one join. >> This would mean killing a lot of queries that work correctly >> right now, but would prevent the class of invalid queries. >> >> 2) Push aggregates into subqueries. R

Re: Joins and aggregates

2009-01-21 Thread Ludvig Ericson
On Jan 21, 2009, at 14:10, Russell Keith-Magee wrote: > Any opinions? Any other options that I may have missed? Sorry if I'm stating the obvious, but would it be impossible to error out if two aggregates cause this unexpected behavior? I mean then I'd say raising an exception for such queries wo

Joins and aggregates

2009-01-21 Thread Russell Keith-Magee
Hi all, I've been looking at ticket #10060, The problem is caused by join behavior in aggregates, but I'm uncertain about the best way to address the problem. Using the example from the ticket, the problem goes like this: You can use double underscore notation for form joins in aggregates: >>>