Dave, I suggest that you give app-engine-patch [1] a try. It's the same Django we all love, but uses GAE Models for datastore access.
You can use django.contrib.auth with it, in fact the patch has extra support for user authentication, check out this [2] page. If you include 'django.contrib.auth.middleware.AuthenticationMiddleware' to your MIDDLEWARE_CLASSES, all your templates will have access to the request.user variable. [3] If you decide to stick to the webapp framework, you can define a base handler class and add the user variable to the templates from its method. [1] http://code.google.com/p/app-engine-patch/ [2] http://code.google.com/p/app-engine-patch/wiki/CustomUserModel [3] http://docs.djangoproject.com/en/dev/topics/auth/#authentication-in-web-requests On Jan 18, 11:42 pm, Dave <[email protected]> wrote: > Thanks Waldemar, That explains it and I fell back on using 'native' > GAE. I'm still learning what to use from Django and when to use > 'native' GAE. > > A follow up question I have is how to add a nickname to the user > model. I've spent a lot of time searching/thinking/tinkering how to do > this and keep ending up with problems. What I really want to > accomplish is to have a nickname for a user available in all views/ > templates. The user case is to enable folks to change their nickname > at will without changing their username/login creds(also it will be > possible to have multiple users with the same nickname which is fairly > important for my user base). > > I have created a UserProfile, with back reference to user model and > can successfully use my_user = user.get_profile() and then access the > nickname via my_user.nickname. Works ok for use in views. > > However, I want to be able to show the nickname when using queries w/ > collections in templates as one can use request.user.username in views > and user.username in templates(i.e. user.nickname). I've looked at use > a custom context processor for this but wondering if that is the best/ > most scalable/preferred method for doing so. > > Ideally it would work such as: > > {% for user in users %} > {{user.nickname}} {{user.email}} ***user.email, > user.username, etc. already work via django.auth > {% endfor %} > > when using a query such as users = user.connections.filter('user =', > myself). > > Any guidance, suggestions, recommendations is appreciated. > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
