Just don't mention the referenced class, and build the query yourself

class Bar(db.Model):
   fluff = db.ReferenceProperty(collection_name='ref1')

q=Barr.all().filter('fluff =', myfoo.key()).fetch(1000)

or make this a property of Foo

def Foo():
  @property
  def bars(self):
    return Barr.all().filter('fluff =', self.key()).fetch(1000)


2008/11/25 p0windah <[EMAIL PROTECTED]>:
>
> I am using Djang0 1.0 with appengine and have bumped up against an odd
> thing.
>
> The order in which models are declared makes a difference.
>
> Using the models.py you will get the following error:
> NameError: name 'Foo' is not defined
>
> While swapping Foo with Bar solves this problem, it is not a practical
> solution when you have numerous models and references scattered across
> them.
>
> So, how are others tackling this problem?
>
> #/project/myapp/models.py – this does not work
> class Bar(db.Model):
>    fluff = db.ReferenceProperty(Foo)
>
> class Foo(db.Model):
>    title = db.StringProperty()
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to