Wednesday, June 30, 2010

Re: using django for google appengine, noob to both.

BaseModel extends db.Model :)



On Wed, Jun 30, 2010 at 8:09 PM, Sector7B <joe.greenawalt@gmail.com> wrote:
Thank you for your reply.  I gave it a try, and it didn't seem to
work.  The helper project (according to the introductory article) has
me using their "BaseModel", which I think is supposed to revert me
back to using Django code.  However there seems to be very little
written beyond that article, although it is a good one.  I went back
to the site, they have a google group specifically for this set up,
I'm going to post over to that group now.  Thanks again.

Joe

On Jun 30, 3:12 pm, Felippe Bueno <felippe.bu...@gmail.com> wrote:
> I think (THINK) you problem is with the db.Model
>
> Take a look athttp://code.google.com/appengine/docs/python/datastore/queryclass.htm...
>
> <http://code.google.com/appengine/docs/python/datastore/queryclass.htm...>You
> will see that db.Model don't have the filter method, db.Query have it.
> You need to do some think like:
> a = XItUser.all()
> a.filter('xit_nickname =', 'awesome')
>
> I'm not sure if there is another way....
>
>
>
> On Wed, Jun 30, 2010 at 4:04 PM, Sector7B <joe.greenaw...@gmail.com> wrote:
> > Hi, I'm using django on google appengine using this:
> >http://code.google.com/appengine/articles/appengine_helper_for_django...
>
> > So I have my models, and I can load my pages and templates, and
> > started to do some rudimentary object creates and gets inside the
> > shell (python manage.py shell) and my views to get a feel for the
> > API.  Immediately Im coming across errors, which seem weird since
> > their so simple, and right out of the sample docs. (http://
> > docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries)
> > I'm guessing i have setup or import problem?  Or I'm missing something
> > major with the appengine way of things, but I am under the impression
> > after the setup it should run the same.  Either way maybe someone can
> > tell me better.
>
> > Thanks,
> > j
>
> > >>> b = XItUser(xit_nickname="awesome")
> > >>> b.save()
> > datastore_types.Key.from_path(u'XItUser', 2L, _app=u'xitforme')
> > >>> b
> > XItUser(**{x_user': None, 'xit_nickname': 'awesome'})
> > >>> x = XItUser.objects.filter(xit_nickname="awesome")
> > Traceback (most recent call last):
> >  File "<console>", line 1, in <module>
> >  File ".../models.py", line 37, in __getattr__
> >    return getattr(self.owner, name)
> > AttributeError: type object 'XItUser' has no attribute 'filter'
> > >>> x = XItUser.objects.get(xit_nickname="awesome")
> > Traceback (most recent call last):
> >  File "<console>", line 1, in <module>
> > TypeError: get() takes exactly 2 non-keyword arguments (1 given)
> > >>> x = XItUser.objects.filter(xit_nickname__iexact="awesome")
> > Traceback (most recent call last):
> >  File "<console>", line 1, in <module>
> >  File ".../models.py", line 37, in __getattr__
> >    return getattr(self.owner, name)
> > AttributeError: type object 'XItUser' has no attribute 'filter'
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscribe@googlegroups.com<django-users%2Bunsubscribe@google groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment