Skip to content

Commit d007d01

Browse files
author
Marc Hughes
committed
New "Add all projects" button
1 parent a20fc10 commit d007d01

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

scrumdo-web/apps/organizations/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
url(r'^(?P<organization_slug>[-\w]+)/edit$', 'organization_edit', name="organization_edit"),
3535
url(r'^(?P<organization_slug>[-\w]+)/export$', 'export_organization', name="export_organization"),
3636
url(r'^(?P<organization_slug>[-\w]+)/delete$', 'delete_organization', name="delete_organization"),
37-
37+
url(r'^(?P<organization_slug>[-\w]+)/favorite_all$', 'favorite_all', name="favorite_all"),
3838
)
3939

4040

scrumdo-web/apps/organizations/views.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from activities.models import NewsItem
3434
from projects.models import Project
3535
from favorites.models import *
36+
import projects.access as access
3637
import organizations.signals as signals
3738
import organizations.import_export as import_export
3839

@@ -250,6 +251,14 @@ def _move_project_to_organization(project, organization, member_team):
250251
member_team.save()
251252
project.save()
252253

254+
@login_required
255+
def favorite_all(request, organization_slug):
256+
organization = get_object_or_404(Organization, slug=organization_slug)
257+
for project in organization.projects.all():
258+
if project.active and access.has_read_access(project, request.user):
259+
Favorite.setFavorite( 1, project.id, request.user, True)
260+
return HttpResponseRedirect( reverse("organization_detail",kwargs={"organization_slug":organization_slug}))
261+
253262
@login_required
254263
def team_debug(request):
255264
read_orgs = Organization.getOrganizationsForUser(request.user)

0 commit comments

Comments
 (0)