check this snippet http://www.djangosnippets.org/snippets/840/
Satheesh On Dec 19, 9:05 am, mono <freeespe...@gmail.com> wrote: > I means if I have three param( I think it is very frequent ), the > style of writing method seem somehow inconvenient. > > eg; > > in code area which handle param1 > if ... url = ?param1=..¶m2=..¶m3=.. > else url = ?param1=..¶m2=..¶m3=.. > > param2 > > if ... url = ?param1=..¶m2=..¶m3=.. > else url = ?param1=..¶m2=..¶m3=.. > > param3 > > if ... url = ?param1=..¶m2=..¶m3=.. > else url = ?param1=..¶m2=..¶m3=.. > > it work, but is duplicated. > > like this: > > link = param1...¶m2...¶m3=... > > param1 > > if ... link.param1=.. > else link.param1=.. > > param2 > if ... link.param2=.. > else link.param2=.. > > ... > > I means so, maybe somehow exactly > > On 12月19日, 上午6時28分, "Wayper, Paul" <paul.way...@transact.com.au> > wrote: > > > > From: mono > > > Sent: Thursday, 18 December 2008 22:10 > > >To: Django users > > > Subject: Re:howtoadd more params in url > > > > I don't know whether it is a good answer because only two > > > page links is here and the aim of is_extend flag istoshow > > > entire or part of columns. > > > > so I could not tell a page linkto > > > is_extend=shrink&page=next_page and > > > is_extend=shrink&page=previous_page > > > > maybe I need more page links, like the first, the last ,or > > > some exactly page number, maybe I need more params like asp > > > or jsp, I hopetohowtodjango dispatch the url with more > > > than one param. > > > I'm not sure quite what you're wantingtodo here or what your problem > > is. > > > The whole idea of query parameters - those things after the '?' symbol > > in key=value pairs - is that they're optionaltothe page. You don't > > needtorecognise these in your URL, so they don't needtobe named > > argumentstoyour view. You can simply say (e.g.): > > > if 'is_extend' in request.GET: > > is_extend = request.GET['is_extend'] > > if is_extend == 'shrink': > > # shrink the page > > elif is_extend == 'expand': > > # expand the page > > > Then you have a similar piece of codetohandle the 'page' parameter and > > so forth. > > > IMO you shouldn't have too many parameters in the path part of the URL - > > the bit before any '?'. > > > Hope this helps, > > > -- > > Paul Wayper > > SYSTEMS ENGINEER > > TransACT > > > Telephone: 02 6229 8026 > > Mobile: 0422 392 081 > > > PO Box 1006, Civic Square ACT 2608 > > >www.transact.com.au --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---