I'm not sure what happened to my previous reply, maybe i sent it to
you directly, lol.. I'm new.

but i think this is what you want:

http://docs.djangoproject.com/en/dev/ref/generic-views/?from=olddocs#django-views-generic-simple-direct-to-template

urlpatterns = patterns('django.views.generic.simple',
    (r'^machine_logs/$', 'direct_to_template', {'template':
'machine_logs.html'}),
    (r'^machine_logs/(?P<unit_name>.*)/$', 'direct_to_template',
{'template': 'machine_logs.html'}),
)

you can access the variable in template from " {{params.unit_name}}

On Oct 21, 2:12 pm, "yuanyun.ken" <[EMAIL PROTECTED]> wrote:
> Hi,all great Django users and developers, I have a little problem.
> In URL dispatcher, is there a way to pass values of Named Groups
> directly to template, don't want to write a view function just for
> this.
> for example, I have the following urls:
>     (r'^machine_logs/$', direct_to_template, {'template':
> 'machine_logs.html'}),
>     (r'^machine_logs/(?P<unit_name>.*)/$', direct_to_template,
> {'template': 'machine_logs.html', 'unit_name':unit_name}),
>
> How can I pass the value of captured unit_name to machine_logs.html.
> Thanks for any help in advance.

--~--~---------~--~----~------------~-------~--~----~
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