1. Sayan Chowdhury
  2. transifex-tmp

Commits

Sayan Chowdhury  committed e84b1a2

Remove permission on Project Delete

  • Participants
  • Parent commits 7643d51
  • Branches default

Comments (0)

Files changed (1)

File transifex/projects/views/project.py

View file
 from django.views.generic import list_detail
 from django.contrib import messages
 from django.contrib.auth.decorators import login_required
+from django.contrib.contenttypes.models import ContentType
 
 from actionlog.models import action_logging, LogEntry
 from actionlog.filters import LogEntryFilter
 from notification import models as notification
-from transifex.projects.models import Project, HubRequest
+from transifex.projects.models import Project, HubRequest, Permission
 from transifex.projects.forms import ProjectAccessControlForm, \
     ProjectForm, ProjectDeleteForm
 from transifex.projects.permissions import *
     if request.method == 'POST':
         delete_form = ProjectDeleteForm(data=request.POST, request=request)
         if delete_form.is_valid():
+    	     pro = Project.objects.get(id=project.id)
+            project_type = ContentType.objects.get_for_model(pro)
+            Permission.objects.filter(content_type__pk=project_type.id,object_id=pro.id).delete()
             _delete_project(request, project)
             return HttpResponseRedirect(reverse(getattr(settings,
                     "REDIRECT_AFTER_PROJECT_DELETE", "project_list")))