Hi Emily,

<snip>
> > >
> > > 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.


Firstly, as phillc suggests, it's a good idea to first name your index
page so it's easier to reference it in your url tags.

> > >
> > > The combinations or parameters I want to use are:
> > >
> > > id
> > > id + filter
> > > filter
> > > and sort_by (alone, or with any of the above combinations)

Since you need that kind of flexibility in which parameters and
combinations you can have, consider using query string parameters
instead of url path parameters.

<snip>
> > >
> > > 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" %}

If you use query strings that would become:

{% url myindex %}?id=3
{% url myindex %}?filter_by=comp
{% url myindex %}?filter_by=comp&sort_by=date

Where myindex is the name of your URL pattern whose regex itself will
also be much simplified now that the parameters are part of the query
string.

In your view, you would obtain the parameters with:

filter_by = request.GET.get('filter_by', None)
sort_by = request.GET.get('sort_by', None)
id = request.GET.get('id', None)

Now, whichever parameters above are not None would be used in your
view logic to build your queries and template context.

-Rajesh D

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