Repository: kartoza/prj.app

Issue:
Sponsorship levels view should be grouped by level
http://changelog.inasafe.org/en/qgis/sponsorshipperiod/list/

Should list the same way as current sponsors are listed (with grouping by sponsorship level).



Discussion:
Hi @timlinux 

This is my pip freeze

```
root@uwsgi:/home/web/django_project# pip freeze
alabaster==0.7.6
astroid==1.4.1
awesome-slugify==1.4
Babel==2.1.1
beautifulsoup4==4.3.2
colorama==0.3.3
coverage==4.0.3
Django==1.8.6
django-braces==1.8.1
django-crispy-forms==1.4.0
django-devserver==0.8.0
django-disqus==0.5
django-embed-video==1.0.0
django-grappelli==2.7.2
django-guardian==1.3.2
django-hashedfilenamestorage==1.0
django-indexer==0.3.0
django-model-utils==1.4.0
django-nose==1.4.2
django-paging==0.2.5
django-pipeline==1.3.11
django-pure-pagination==0.2.1
django-reversion==1.9.3
django-rosetta==0.7.0
django-sentry==1.13.5
django-templatetag-sugar==1.0
django-userena==1.4.1
django-widget-tweaks==1.3
docutils==0.12
easy-thumbnails==2.2.1
eventlet==0.17.4
factory-boy==2.6.0
fake-factory==0.5.3
fancycompleter==0.4
flake8==2.5.0
funcsigs==0.4
futures==3.0.3
greenlet==0.4.9
hizashi-utils==0.4.1
html2text==2014.12.29
Jinja2==2.8
lazy-object-proxy==1.2.1
lockfile==0.11.0
Markdown==2.3.1
MarkupSafe==0.23
mccabe==0.3.1
mock==1.3.0
nose==1.3.7
ordereddict==1.1
pbr==1.8.1
pdbpp==0.8.3
pep8==1.5.7
Pillow==3.0.0
psycopg2==2.6.1
pyflakes==1.0.0
Pygments==2.0.2
pylint==1.5.1
pypandoc==0.6.0
pyrepl==0.8.4
python-daemon==2.0.6
pytz==2015.7
raven==5.8.1
regex==2015.11.14
requests==1.2.3
six==1.10.0
snowballstemmer==1.2.0
South==1.0.2
Sphinx==1.3.3
sphinx-rtd-theme==0.1.9
Unidecode==0.4.18
uWSGI==2.0.11.2
virtualenv==13.1.2
wheel==0.24.0
wmctrl==0.3
wrapt==1.10.5
```

This is from the live server:

```

awesome-slugify==1.4
beautifulsoup4==4.3.2
Django==1.8.8
django-braces==1.8.1
django-crispy-forms==1.4.0
django-disqus==0.5
django-embed-video==1.0.0
django-grappelli==2.7.3
django-hashedfilenamestorage==1.0
django-indexer==0.3.0
django-model-utils==1.4.0
django-paging==0.2.5
django-pipeline==1.3.11
django-pure-pagination==0.3.0
django-reversion==1.9.3
django-rosetta==0.7.0
django-sentry==1.13.5
django-templatetag-sugar==1.0
django-widget-tweaks==1.3
docutils==0.12
easy-thumbnails==2.3
eventlet==0.18.1
funcsigs==0.4
futures==3.0.4
greenlet==0.4.9
lockfile==0.12.2
Markdown==2.3.1
mock==1.3.0
pbr==1.8.1
Pillow==3.1.0
piroot@uwsgi:/home/web/django_project# pip freeze
psycopg2==2.6.1
pypandoc==0.6.0
python-daemon==2.1.0
pytz==2015.7
raven==5.8.1
regex==2016.01.10
requests==1.2.3
six==1.10.0
South==1.0.2
Unidecode==0.04.19
uWSGI==2.0.12
virtualenv==1.11.6
wsgiref==0.1.2
```


Resolving patch:
diff --git a/django_project/changes/views/sponsorship_period.py b/django_project/changes/views/sponsorship_period.py
--- a/django_project/changes/views/sponsorship_period.py
+++ b/django_project/changes/views/sponsorship_period.py
@@ -156,7 +156,10 @@ def get_queryset(self, queryset=None):
             project_slug = self.kwargs.get('project_slug', None)
             if project_slug:
                 project = Project.objects.get(slug=project_slug)
-                queryset = SponsorshipPeriod.objects.filter(project=project)
+                queryset = \
+                    SponsorshipPeriod.objects.filter(
+                        project=project).order_by(
+                        '-sponsorship_level__value', '-end_date')
                 return queryset
             else:
                 raise Http404('Sorry! We could not find your Sponsor Period!')


Test patch: