For anyone else maybe struggling with this, what Josh meant was you would 
change the following in views.py:

context = Context()
    return HttpResponse(template.render(context))

To instead use RequestContext so you would have something like this: 
(removing the context =... line)
return render_to_response('regform/registration.html', 
context_instance=RequestContext(request))



On Friday, May 24, 2013 6:06:56 PM UTC-6, Chi-Cheong Weng wrote:
>
> I digged a little deeper. If I removed line 35 of based.html (script 
> src="{% static "mezzanine/js/"|add:settings.JQUERY_FILENAME %}"></script>, 
> which is actually mezzanine/js/jquery-1.7.1.min.js) and line 3 of 
> includes/footer_scripts.html (i.e. {% editable_loader %}), the page can 
> render, but then I  lost the inline editable feature when I logged in as 
> admin. Apparently me the inline-editable thing is not happy with this.
>
> Any clue how my extending base.html in my template file could *cause*this 
> behavior? I see other mezzanine apps do this without causing any 
> problems (e.g. mezzanine/accounts/templates/accounts/account_form.html)
>
> I dont understand what you meant by "I need to use a RequestContext", how 
> and where do I make such change?
>
> On Saturday, May 25, 2013 2:04:26 AM UTC+8, Josh Cartmell wrote:
>>
>> I think that you need to *user a RequestContext instead of a normal 
>> Context *because the settings variable is only inserted into a 
>> RequestContext by Mezzanine.
>>
>> On Fri, May 24, 2013 at 9:02 AM, Chi-Cheong Weng <[email protected]>wrote:
>>
>>> My goal is to use the default mezzanine layout (i.e. one top nav bar 
>>> plus three columns) for my project app.
>>> But I keep having problems when I try to extend the mezzanine's 
>>> base.html in my app templates.
>>>
>>> My new mezzanine app is called people. I added url(r"^people/", 
>>> include("people.urls")) to mysite/urls.py. I also added "people" to the end 
>>> of INSTALLED_APPS in mysite/settings.py 
>>>
>>> Here are what mysite/people/urls.py and mysite/people/views.py look:
>>>
>>> urls.py:
>>> from django.conf.urls import patterns, url
>>> from people import views
>>> urlpatterns = patterns('',
>>>     # list recent reviews
>>>     url(r'^$', views.index, name='index'),
>>>     )
>>>
>>> views.py:
>>> from django.shortcuts import render
>>> from django.http import Http404, HttpResponse
>>> from django.template import Context, loader
>>> from people.models import Person
>>> def index(request):
>>>     latest_people_list = Person.objects.order_by("-last_name")[:10]
>>>     template = loader.get_template("people/index.html")
>>>     context = Context()
>>>     return HttpResponse(template.render(context))
>>>
>>> The index.html for http://mysite/people is located at 
>>> mysite/people/templates/people/index.html
>>> If I kept the following *two lines* at the *beginning* of my 
>>> index.html, the page would not render. If I removed those two lines, the 
>>> page renders but I lost of the default mezzanine layout, which I don’t want 
>>> to. Does anyone know what I am missing? Your help will be appreciated.
>>>
>>>
>>> *{% extends "base.html" %}{% load i18n mezzanine_tags %}*
>>>
>>> Here is the complete error message:
>>>
>>> VariableDoesNotExist at /reviews/ 
>>>
>>> Failed lookup for key [settings] in u"[{'False': False, 'None': None, 
>>> 'True': True}]"
>>>
>>>  Request Method: GET  Request URL: http://127.0.0.1:8000/reviews/  Django 
>>> Version: 1.5.1  Exception Type: VariableDoesNotExist  Exception Value: 
>>>
>>> Failed lookup for key [settings] in u"[{'False': False, 'None': None, 
>>> 'True': True}]"
>>>
>>>  Exception Location: 
>>> /home/cweng/Envs/ratecoworkers/local/lib/python2.7/site-packages/django/template/base.py
>>>  
>>> in _resolve_lookup, line 771  Python Executable: 
>>> /home/cweng/Envs/ratecoworkers/bin/python  Python Version: 2.7.1  Python 
>>> Path: 
>>>
>>> ['/home/cweng/workspace',
>>>  '/home/cweng/workspace/ratecoworkers',
>>>  
>>> '/home/cweng/Envs/ratecoworkers/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
>>>  
>>> '/home/cweng/Envs/ratecoworkers/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
>>>  '/home/cweng/Envs/ratecoworkers/lib/python2.7',
>>>  '/home/cweng/Envs/ratecoworkers/lib/python2.7/plat-linux2',
>>>  '/home/cweng/Envs/ratecoworkers/lib/python2.7/lib-tk',
>>>  '/home/cweng/Envs/ratecoworkers/lib/python2.7/lib-old',
>>>  '/home/cweng/Envs/ratecoworkers/lib/python2.7/lib-dynload',
>>>  '/usr/lib/python2.7',
>>>  '/usr/lib/python2.7/plat-linux2',
>>>  '/usr/lib/python2.7/lib-tk',
>>>  '/home/cweng/Envs/ratecoworkers/local/lib/python2.7/site-packages']
>>>
>>>  Server time: Fri, 24 May 2013 23:11:20 +0800  
>>> Error during template rendering 
>>>
>>>
>>> *In template 
>>> /home/cweng/Envs/ratecoworkers/local/lib/python2.7/site-packages/mezzanine/core/templates/base.html,
>>>  
>>> error at line 35 {If I remove this line (i.e. line 35) in base.html, there 
>>> will be other errors!} *
>>> (Could not get exception message) 25 {% ifinstalled cartridge.shop %} 26 
>>> <link 
>>> rel="stylesheet" href="{% static "css/cartridge.css" %}"> 27 {% if 
>>> LANGUAGE_BIDI %} 28 <link rel="stylesheet" href="{% static 
>>> "css/cartridge.rtl.css" %}"> 29 {% endif %} 30 {% endifinstalled %} 31 {% 
>>> block extra_css %}{% endblock %} 32 {% endcompress %} 33 
>>> 34 {% compress js %} 35 <script src="{% static 
>>> "mezzanine/js/"|add:settings.JQUERY_FILENAME %}"></script> 36 <script 
>>> src="{% static "js/bootstrap.js" %}"></script> 37 <script src="{% 
>>> static "js/bootstrap-extras.js" %}"></script> 38 {% block extra_js %}{% 
>>> endblock %} 39 {% endcompress %} 40 <!--[if lt IE 9]> 41 <script 
>>> src="{% static "js/html5shiv.js" %}"></script> 42 <![endif]--> 43 
>>> 44 {% block extra_head %}{% endblock %} 45 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to