I'm converting a small PHP application to Django.
One section has a long query string, indicating how a widget is to be displayed. There are a few required parameters and several optional ones.
The current urls read like:
app.php?id=102030&size=large&auto=0&bw=1&extra=1
The id and size are required, but auto, bw and extra are optional. I use defaults if they're not specified.
My first idea was to make a django URL pattern with the required info, id and size:
url(r'^/app/(P?<id>)\d+/(P?<size>)\w+$',app.project.views.widget,name='swidget')
The optional parameters would then be a query string, like
/app/102030/large?auto=0&bw=1&extra=0
Is it a common practice to mix GET parameters with parameters defined in the URL conf in Django? Or should I make it like
url(r'^/app/(P?<id>)\d+/(P?<size>)\w+/(P?<auto>)\d/(P?<bw>)\d/(P?<extra>)\d[/]?,'app.project.views.widget,name='swidget')
#so it would look like:
/app/102030/large/0/1/0/
Any suggestions about best practices or issues to keep in mind with either style are appreciated!