use of named urls will probably make that a ton easier

On Jun 19, 11:45 am, "Emily Rodgers" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been hitting a brick wall so many times now on this that it is
> starting to hurt!! Please help if you can...
>
> I have an index page, and I want my function for it (in views.py) to take a
> number of parameters to decide what to display, but I can't figure out how
> to do it.
>
> The kinds of options I want to give it are things like, pkid of the thing I
> want to select (for more details), a filter to apply to the list of things
> shown on the index page, the name of the attribute I want to sort the index
> table by.
>
> The problems I am hitting are mainly to do with the {% url
> app.views.function keyword=optval %} tags to generate urls for my link bar.
>
> The combinations or parameters I want to use are:
>
> id
> id + filter
> filter
> and sort_by (alone, or with any of the above combinations)
>
> I have managed to write a regex to understand these options and my views
> function does what I want, but with that regex, the {% url blah thing %}
> just doesn't work at all. Do I need to just write loads of separate regexes
> (for different combinations!)?
>
> The regex that works (reading urls), but doesn't generate urls is something
> along the lines of:
>
> r'^co(|(?P<id>\d*)/)(|/filter/(?P<filter_by>\w*)/)(|sort/(?P<sort_by>\w*)/)$
> '
>
> The kinds of url tag things I have been using are:
>
> {% url myapp.views.index id=3 %}
> {% url myapp.views.index filter_by="comp" %}
> {% url myapp.views.index filter_by="comp",sort_by="date" %}
>
> But they just evaluate to an empty string :(
>
> The problem is the option thing. Am I just being lazy / stupid?
>
> Em
>
> Information Security Analyst, ARM Ltd,
> 110 Fulbourn Road, Cambridge CB1 9NJ, UK
> Tel: +44 (0) 1223 406 365
--~--~---------~--~----~------------~-------~--~----~
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