Re: A very simple application

2005-12-31 Thread Michael Hipp
Jacob Kaplan-Moss wrote: On Dec 31, 2005, at 11:14 AM, Michael Hipp wrote: How do I make this work? In mysite/apps/simple/views.py I have: from django.core.extensions import render_to_response def saysomething(request): assert False, "Test assert" return

Re: A very simple application

2005-12-31 Thread Jacob Kaplan-Moss
On Dec 31, 2005, at 11:14 AM, Michael Hipp wrote: How do I make this work? In mysite/apps/simple/views.py I have: from django.core.extensions import render_to_response def saysomething(request): assert False, "Test assert" return render_to_response('base', {'message': "My

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/31/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > Who/what is the caller? Whatever method calls 'HttpResponse()'. In this case, the view. > It's not that I have something against render_to_response, it's that all the > tutorials and docs seem to be saying that the "correct" way is

Re: A very simple application

2005-12-30 Thread Michael Hipp
limodou wrote: HttpResponse just return the message to the caller, not directly to the screen. Who/what is the caller? render_to_response is a utility function provided by django, if you don't want to use it, you can do it yourself, just like: It's not that I have something against

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > I don't know how to reconcile this with what James Bennett and limodou wrote > about using render_to_response() instead of HttpResponse() as none of the > examples in the docs use render_to_response() as their return value from the > view

Re: A very simple application

2005-12-30 Thread limodou
> Yes. But I still seem to be off somewhere... > > From > http://www.djangoproject.com/documentation/tutorial3/#write-your-first-view > there is: > -- > from django.utils.httpwrappers import HttpResponse > > def index(request): > return HttpResponse("Hello, world. You're at the

Re: A very simple application

2005-12-30 Thread limodou
2005/12/31, Michael Hipp <[EMAIL PROTECTED]>: > > I have a base.html that is a skeleton html document with this call to my > 'simple' app added: > >{{ simple.saysomething }} You may make a wrong understand about the view, url-dispatch, and template. The view is used to provide methods which

Re: A very simple application

2005-12-30 Thread Adrian Holovaty
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > But what about the "root" of the website, how do you specify a view for just > "mysite.com"? To target the root, use '^$' as the regular expression, like so: urlpatterns = patterns('', (r'^$', 'path.to.my_view'), ) Does this answer

Re: A very simple application

2005-12-30 Thread Michael Hipp
James Bennett wrote: On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: I have a base.html that is a skeleton html document with this call to my 'simple' app added: {{ simple.saysomething }} You never call the view function from inside the template; by the time Django is rendering the