#169 Team delete-restore
* adds restorable delete functionality to Team model * refactors minor code model parts by introducing DeletableObjectMixin * only non-deleted Teams can be chosen for sharing * deleted Teams can be restored using the proper function on the backend admin * deleted Teams do not provide * adds migration
This commit is contained in:
+5
-1
@@ -230,8 +230,8 @@ class NewTeamModalForm(BaseModalForm):
|
||||
team = Team.objects.create(
|
||||
name=self.cleaned_data.get("name", None),
|
||||
description=self.cleaned_data.get("description", None),
|
||||
admins__in=[self.user],
|
||||
)
|
||||
team.admins.add(self.user)
|
||||
members = self.cleaned_data.get("members", User.objects.none())
|
||||
if self.user.id not in members:
|
||||
members = members.union(
|
||||
@@ -335,6 +335,10 @@ class RemoveTeamModalForm(RemoveModalForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.form_caption = _("ATTENTION!\n\nRemoving the team means all members will lose their access to data, based on this team! \n\nAre you sure to remove this team?")
|
||||
|
||||
def save(self):
|
||||
self.instance.mark_as_deleted(self.user)
|
||||
return self.instance
|
||||
|
||||
|
||||
class LeaveTeamModalForm(RemoveModalForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user