Skip to content
Snippets Groups Projects
Commit 28ff090a authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Add method to Superevent model for GOP groups

Added a method to the Superevent model which returns a list of groups
who have group object permissions for that particular superevent.
Could be useful in the future.
parent 56876aa4
No related branches found
No related tags found
1 merge request!8Superevents
......@@ -9,6 +9,7 @@ import shutil
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group as AuthGroup
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import models, IntegrityError
......@@ -253,6 +254,11 @@ class Superevent(CleanSaveModel, AutoIncrementModel):
# Save the fields which have changed
self.save(update_fields=['is_gw', 'gw_letter_suffix'])
def get_groups_with_groupobjectpermissions(self):
gops = self.supereventgroupobjectpermission_set.all()
gop_group_pks = gops.values_list('group', flat=True).distinct()
return AuthGroup.objects.filter(pk__in=gop_group_pks)
def get_absolute_url(self):
return self.get_web_url()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment