Alexander & all, Thanks for directing me to this. I just added it in and works perfectly! This is just what I needed.
Your the man! dgd On Jan 19, 8:13 am, Dave <[email protected]> wrote: > Hi Alexander, Thanks for the info. Actually I am using app-engine- > patch since I wanted to use Django 1(btw, it's a very cool way to get > to Django 1 vs. doing all the other manual installs). I just read the > links below and think I now understand how to use the rajenda code and > will give it a try. I saw this before but guess I forget/didn't > understand what I was reading. > > Thx so much! > > On Jan 18, 6:06 pm, Alexander Kojevnikov <[email protected]> > wrote: > > > 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-w... > > > 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 -~----------~----~----~----~------~----~------~--~---
