Re: subqueries

2007-11-06 Thread Matthew Fremont
On Nov 6, 5:18 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On the queryset-refactor branch, I've changed the way Q() objects are > handled so that it will be easier to write your own variants on these. > Basically, the Q-like object (by which I mean, any object you can pass > to a filter

Re: Help with loader error

2007-11-06 Thread Gary Wilson
Charles wrote: > I've installed Django v.0.96 on an Ubuntu Linux 7.10 system and am > going through the tutorial available at the Django site. The latest > error popped up when I tried to run the admin app. The current error > is: > > ImproperlyConfigured at /admin/ > Module "django.template.load

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-06 Thread Malcolm Tredinnick
On Wed, 2007-11-07 at 00:50 +, Dmitri Fedortchenko wrote: > Example code: > > def save(self): > regex = re.compile("\{\{([^\}]{2,60})\}\}") > words = regex.findall(self.body) > self.body = regex.sub("\\1",self.body) > super(Chapter,self).save() > for word in word

Re: subqueries

2007-11-06 Thread Malcolm Tredinnick
On Tue, 2007-11-06 at 22:43 +, Matthew Fremont wrote: > What is the current thinking about whether/when the ORM will be > extended to allow formulation of correlated and dynamic subqueries > without requiring raw SQL? > > My motivation right now is that I have a few queries that are probably

Re: Help with permissions

2007-11-06 Thread Malcolm Tredinnick
On Tue, 2007-11-06 at 13:16 -0800, Frank Gutiérrez Domínguez wrote: > Hello: > I'm working on a site that needs to manage (add/delete/modify) users > of a proxy server and I'm trying to get advantage of the Django's > features for these stuff, but I crashed myself to a wall with Django's > Auth pe

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Malcolm Tredinnick
On Tue, 2007-11-06 at 10:06 -0600, Jeremy Dunck wrote: > On 11/6/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > > > You can use a property. Code not tested: > > Of course. I just have about 30 places to do that legwork, which seems silly. > > I understand Malcolm's argument, though. This i

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-06 Thread Collin Grady
Are you seeing this behavior in admin? If so, I believe that is what is actually at fault, since it hard-sets m2ms, which would clear anything set in save(). Also, you don't need to call save() again after adding to an m2m, since it does not edit the model instance itself, but the related table.

Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-06 Thread Dmitri Fedortchenko
Example code: def save(self): regex = re.compile("\{\{([^\}]{2,60})\}\}") words = regex.findall(self.body) self.body = regex.sub("\\1",self.body) super(Chapter,self).save() for word in words: if len(word.strip()) > 0:

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Tai Lee
I had previously used OneToOne relationships and liked the auto mapping they did, as in the OP's example. I was told that OneToOne didn't work in some cases and was going away, and that I should use ForeignKey(unique=True) instead. If there are technical problems with OneToOne and ForeignKey(uniq

subqueries

2007-11-06 Thread Matthew Fremont
What is the current thinking about whether/when the ORM will be extended to allow formulation of correlated and dynamic subqueries without requiring raw SQL? My motivation right now is that I have a few queries that are probably best expressed using correlated "EXISTS (SELECT ...)" or "... IN (S

Re: Help with loader error

2007-11-06 Thread James Bennett
On Nov 6, 2007 4:17 PM, Charles <[EMAIL PROTECTED]> wrote: > I've installed Django v.0.96 on an Ubuntu Linux 7.10 system and am > going through the tutorial available at the Django site. The latest > error popped up when I tried to run the admin app. The current error > is: > > ImproperlyConfigure

Help with loader error

2007-11-06 Thread Charles
I've installed Django v.0.96 on an Ubuntu Linux 7.10 system and am going through the tutorial available at the Django site. The latest error popped up when I tried to run the admin app. The current error is: ImproperlyConfigured at /admin/ Module "django.template.loaders.filesystem" does not defi

Help with permissions

2007-11-06 Thread Frank Gutiérrez Domínguez
Hello: I'm working on a site that needs to manage (add/delete/modify) users of a proxy server and I'm trying to get advantage of the Django's features for these stuff, but I crashed myself to a wall with Django's Auth permissions, because their policy goes something like: and I need various level

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Marty Alchin
On 11/6/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 11/6/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > > > You can use a property. Code not tested: > > Of course. I just have about 30 places to do that legwork, which seems silly. Well, you could write up a function to create the prop

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Jeremy Dunck
On 11/6/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > You can use a property. Code not tested: Of course. I just have about 30 places to do that legwork, which seems silly. I understand Malcolm's argument, though. This is why I asked rather than just making the small change in my local Dj

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Thomas Guettler
Am Montag, 5. November 2007 18:47 schrieb Jeremy Dunck: > Consider: > > class Place(Model): > ... > > class Retaurant(Model): > place = ForeignKey(Place, unique=True) > You can use a property. Code not tested: class Place(Model): def get_restaurant(self): try:

Re: Handling non-string values during serialization

2007-11-06 Thread Marty Alchin
On 11/6/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > Malcolm has pretty much nailed this one already. However, for the > historical perspective: flatten_data is an artefact of the oldform > era, and the original serializers were written before newforms. The > discrepancy between the Python

Re: Handling non-string values during serialization

2007-11-06 Thread Russell Keith-Magee
On 11/6/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > Hey everyone (Russ in particular), it's me again. Hi Marty, > Can anybody with more experience with serializers help explain why > this discrepancy exists, and what's the best way to go about handling > it? Malcolm has pretty much nailed t