KristianOellegaard/django-hvad — pull request #203 by Chive (2014-10-11 19:59:13+00:00)
Title: fix language tab URLs when using list filters

This is cc #202 and fixes the issue mentioned there regarding the scrambling of the language tab URLs.

The data below was retrieved by setting a pdb trace at the beginning of the method ``hvad.admin.TranslatableModelAdminMixin#get_language_tabs``.

**Before this PR**
```python
# After searching for 'tom' in the changelist view and clicking on a result
> request.get_full_path()
'/en/admin/app/model/1/?_changelist_filters=q%3Dtom'

# bad
> dict(request.GET), urlencode(dict(request.GET))
{u'_changelist_filters': [u'q=tom']}
'_changelist_filters=%5Bu%27q%3Dtom%27%5D'

# better
> request.GET, request.GET.urlencode()

'_changelist_filters=q%3Dtom'
```

```python
# after changing the language tab to 'fr'
> request.get_full_path()
'/en/admin/app/model/1/?_changelist_filters=%5Bu%27q%3Dtom%27%5D&language=fr'

# bad
> dict(request.GET), urlencode(dict(request.GET))
{u'_changelist_filters': [u"[u'q=tom']"], u'language': [u'fr']}
'_changelist_filters=%5Bu%22%5Bu%27q%3Dtom%27%5D%22%5D&language=%5Bu%27fr%27%5D'

# better
> request.GET, request.GET.urlencode()

'_changelist_filters=%5Bu%27q%3Dtom%27%5D&language=fr'
```

**After this PR**
```python
# After searching for 'tom' in the changelist view and clicking on a result
> request.get_full_path()
'/en/admin/app/model/1/?_changelist_filters=q%3Dtom'

# bad
> dict(request.GET), urlencode(dict(request.GET))
{u'_changelist_filters': [u'q=tom']}
'_changelist_filters=%5Bu%27q%3Dtom%27%5D'

# better
> request.GET, request.GET.urlencode()

'_changelist_filters=q%3Dtom'

```

```python
# after changing the language tab to 'fr'
> request.get_full_path()
'/en/admin/app/model/1/?_changelist_filters=q%3Dtom&language=fr'

# bad
> dict(request.GET), urlencode(dict(request.GET))
{u'_changelist_filters': [u'q=tom'], u'language': [u'fr']}
'_changelist_filters=%5Bu%27q%3Dtom%27%5D&language=%5Bu%27fr%27%5D'

# better
> request.GET, request.GET.urlencode()

'_changelist_filters=q%3Dtom&language=fr'
```