On Sun, Mar 22, 2009 at 9:06 PM, [email protected]
<[email protected]>wrote:
>
> I'm trying to compare the current user logged on to user stored in the
> database (using GAE - Google App Engine).
>
> Here are my four attempts so far and their results:
>
> 1) {%ifequal conference.userAdded user.email %}
> 2) {%ifequal {conference.userAdded} {user.email} %}
> 3) {%ifequal {{conference.userAdded}} {{user.email}} %}
> 4) {%ifequal conference.userAdded params['user'].email %}
>
> 1) always false
> 2) always true
> 3) always true
> 4) always false
>
>
> Here is my full template code (the else shows the values of the fields
> I'm trying to compare, and when I do a view source in the browser,
> they are definitely equal.
>
> {%ifequal {{conference.userAdded}} {{user.email}} %}
> <a href="{%url views.edit conference.key.id%}">
> {{ forloop.counter }}</a>
> {%else%}
> {{ forloop.counter }} <br>{{user.email}}<br>
> {{conference.userAdded}}
> {%endifequal%}
>
>
> The user is coming from here in the view (from the "gift" sample I
> downloaded, no changes to the "respond" method:
>
> def respond(request, user, template, params=None):
> if params is None:
> params = {}
> if user:
> params['user'] = user
> params['sign_out'] = users.CreateLogoutURL('/')
> params['is_admin'] = (users.IsCurrentUserAdmin() and
> 'Dev' in os.getenv('SERVER_SOFTWARE'))
> else:
> params['sign_in'] = users.CreateLoginURL(request.path)
> if not template.endswith('.html'):
> template += '.html'
> return shortcuts.render_to_response(template, params)
>
> Thanks,
> Neal Walters
>
>
>
>
> >
>
Firstly, any usage of {{ inside a tempalte tag is an invalid syntax.
Secondly, I don't see confrence anywhere in that function, so how is it
getting into the context. Thirdly, what exactly are you trying to do?
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---