You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
486 B

  1. from django.conf import settings
  2. from api.models import Project
  3. from roles.models import Role
  4. from .models import Member
  5. def add_administrator_on_project_creation(sender, instance: Project, created: bool, **kwargs):
  6. # In the case of creating a project.
  7. if created:
  8. admin_role = Role.objects.get(name=settings.ROLE_PROJECT_ADMIN)
  9. Member.objects.create(
  10. project=instance,
  11. user=instance.created_by,
  12. role=admin_role,
  13. )