Reputation: 3
I keep getting this error when using django templates in Google App Engine:
TemplateSyntaxError: Invalid block tag: 'endif'
python code:
class SuperAdmin(webapp.RequestHandler):
def get(self):
#set the user object
user = users.get_current_user()
# See if user is logged in
if user: # signed in already
#Create Logout URL
logoutUrl = users.create_logout_url(self.request.uri)
template_values['logoutUrl'] = logoutUrl
#is this user a super admin
isSuperAdmin = acl_authentication.AuthenticateUserViaAcl().isUserSuperAdmin(user.email(), user.user_id())
template_values['isSuperAdmin'] = isSuperAdmin
#Use our auth object to see if the user is allowed on this page
if acl_authentication.AuthenticateUserViaAcl().IsUserPermitted(user.user_id(), user.email(), '0', '0', 50): #User is allowed
self.response.out.write("This user is in the acl db and a super admin<br/>")
#Add action1 to template_values
template_values['action1'] = self.request.get('action1')
#Write the Header
path = os.path.join(os.path.dirname(__file__), 'adminHeader.html')
self.response.out.write(template.render(path, template_values))
#Write the Login Page
path = os.path.join(os.path.dirname(__file__), 'SuperAdmin.html')
self.response.out.write(template.render(path, template_values))
#Write the Header
path = os.path.join(os.path.dirname(__file__), 'adminFooter.html')
self.response.out.write(template.render(path, template_values))
else: #User is not allowed
#Log to DB that we hit access denied page
acl_authentication.AuthenticateUserViaAcl().LogToDbAccessDeniedHit(user.user_id(), user.email(), self.request.url)
#Redirect to Access Denied Page
self.redirect("/AccessDeniedPage")
else: #User is not logged in
self.redirect("/LoginPage?destUrl=" + self.request.url)
.html template code
<!-- Begin If action1==manage_companies -->
{% if action1 == "manage_companies" % }
<tr>
<td>Manage Companies</td>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
{% endif %}
<!-- /End If action1==manage_companies -->
I'm not familiar with django so im lost here. Thanks
Upvotes: 0
Views: 1493
Reputation: 3040
There's an extra space between '%' and '}' in this line
{% if action1 == "manage_companies" % }
try changing it to
{% if action1 == "manage_companies" %}
Upvotes: 2