Commits

Gaurav Kumar  committed d3ed8e8

Delete writer permissions for a project when it is deleted.

  • Participants
  • Parent commits 05aebb8

Comments (0)

Files changed (1)

File transifex/projects/views/project.py

 from transifex.resources.models import Resource, RLStats
 from transifex.resources.utils import invalidate_template_cache
 from transifex.teams.forms import TeamRequestSimpleForm
+from django.contrib.contenttypes.models import ContentType
+from transifex.projects.models import Permission
 
 # Temporary
 from transifex.txcommon import notifications as txnotification
     if request.method == 'POST':
         delete_form = ProjectDeleteForm(data=request.POST, request=request)
         if delete_form.is_valid():
+	    dp = Project.objects.get(id = project.id)
+	    project_type = ContentType.objects.get_for_model(dp)
+	    Permission.objects.filter(content_type__pk=project_type.id,object_id=dp.id).delete() 
             _delete_project(request, project)
             return HttpResponseRedirect(reverse(getattr(settings,
                     "REDIRECT_AFTER_PROJECT_DELETE", "project_list")))