On 12/27/06, Nader <[EMAIL PROTECTED]> wrote:
This is a definition of detail function in my views.py model

def detail(request, object_id):
    wk-report = get_object_or_404(Report, pk=object_id)
    return render_to_response('weekly/weekly_detail.html',
                              {'object': wk-report})

Then I reference to the object 'wk-report' in the week_detail.html', I
don't get any value. But If I replace it with 'object', then I get the
result. Does it mean that the return value (object) of the
'get_object_or_404' is 'object'?

Coupla things here.

First, you shouldn't have a Python variable called "wk-report" --
hyphens are not allowed in object names.

Second, in the code you pasted, your template will have access to the
variable "object", because that's what you told it the variable would
be called. This dictionary:

   {'object': wkreport}

...tells the template system to make available the object wkreport as
the template variable called "object".

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to