Skip to content

Commit

Permalink
Merge pull request #1822 from akvo/#1799-myrsr-all-projects
Browse files Browse the repository at this point in the history
[#1799] Show all projects in MyRSR for superusers or RSR admins
  • Loading branch information
KasperBrandt committed Oct 5, 2015
2 parents b4492e3 + c0ae31e commit d864917
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions akvo/rsr/views/my_rsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ def my_updates(request):
def my_projects(request):
"""Directory of Projects connected to the user."""
organisations = request.user.employers.approved().organisations()
projects = organisations.all_projects().distinct().select_related(
'publishingstatus',
'primary_location__country',
)

if request.user.is_superuser or request.user.is_admin:
projects = Project.objects.all()
else:
projects = organisations.all_projects().distinct().select_related(
'publishingstatus',
'primary_location__country',
)

new_project_custom_fields = OrganisationCustomField.objects.filter(
organisation__in=organisations
Expand Down

0 comments on commit d864917

Please sign in to comment.