Hi, Bruno, thanks for a reply.
I'm trying to get a path by which a certain function is accessed.
http://www.djangoproject.com/documentation/templates/#url
This is a docstring from {% url %} tag function, which explains
everything nicely:
Returns an absolute URL matching given view with its parameters.
This is a way to define links that aren't tied to a particular URL
configuration::
{% url path.to.some_view arg1,arg2,name1=value1 %}
The first argument is a path to a view. It can be an absolute
python path
or just ``app_name.view_name`` without the project name if the
view is
located inside the project. Other arguments are comma-separated
values
that will be filled in place of positional and keyword arguments
in the
URL. All arguments for the URL should be present.
For example if you have a view ``app_name.client`` taking client's
id and
the corresponding line in a URLconf looks like this::
('^client/(\d+)/$', 'app_name.client')
and this app's URLconf is included into the project's URLconf
under some
path::
('^clients/', include('project_name.app_name.urls'))
then in a template you can create a link for a certain client like
this::
{% url app_name.client client.id %}
The URL will look like ``/clients/client/123/``.
On 5 Jun, 20:09, "Bruno Tikami" <[EMAIL PROTECTED]> wrote:
> Armandas,
>
> The url patterns are not sent within the HttpResponse and therefore not
> passed to the template context. What exactly are you trying to do ?
>
> Porbably, it's just a small fix on your views .
>
> []s!
>
> Tkm
>
>
>
> On Thu, Jun 5, 2008 at 3:40 PM, Armandas <[EMAIL PROTECTED]> wrote:
>
> > Hi, I have problems making {% url %} work.
>
> > I have this urls.py file in my project directory:
> > from django.conf.urls.defaults import *
>
> > urlpatterns = patterns('root',
> > (r'^blog/', include('blogapp.urls')),
> > (r'^admin/', include('django.contrib.admin.urls')),
> > )
>
> > then in my applicatoion folder, another urls.py (which is included in
> > first file):
> > from django.conf.urls.defaults import *
>
> > urlpatterns = patterns('blogapp.views',
> > (r'^$', 'homepage'),
> > (r'^([a-z0-9-]+).html(#[a-z]+)?$', 'post_by_name'),
> > (r'^tags/([a-z0-9-]+)/$', 'posts_by_tag'),
> > )
>
> > Now I'm adding {% url posts_by_tag %} in my template, but it doesn't
> > output anything. I also tried the following combinations:
> > {% url blogapp.posts_by_tag %}
> > {% url blogapp.views.posts_by_tag %}
>
> > Do you have any suggestions?
>
> > Thanks.
>
> --
> []s!
>
> Tkmhttp://djangopeople.net/brunotikami/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---