diff --git a/program/models.py b/program/models.py index f0f0df2b5cf2237b144a9870f5f643e23ce2fcfc..2525729645ead96f57ba1438be3084b0fb078f6e 100644 --- a/program/models.py +++ b/program/models.py @@ -116,19 +116,6 @@ class Host(models.Model): for size in THUMBNAIL_SIZES: self.image.thumbnail = self.image.crop[size].name - # FIXME: this does not belong here - @staticmethod - def is_editable(host_view_set, host_id): - """ - Whether the given host is assigned to a show the current user owns - @return boolean - """ - if host_view_set.request.user.is_superuser: - return True - - host_ids = Host.objects.filter(shows__in=host_view_set.request.user.shows.all()).distinct().values_list('id', flat=True) - return int(host_id) in host_ids - class Link(models.Model): host = models.ForeignKey(Host, on_delete=models.CASCADE, related_name='links') @@ -166,19 +153,6 @@ class Show(models.Model): class Meta: ordering = ('slug',) - # FIXME: this does not belong here - @staticmethod - def is_editable(show_view_set, show_id): - """ - Whether the current user is owner of the given show - @return boolean - """ - if show_view_set.request.user.is_superuser: - return True - - show_ids = show_view_set.request.user.shows.all().values_list('id', flat=True) - return int(show_id) in show_ids - class RRule(models.Model): name = models.CharField(max_length=32, unique=True) @@ -918,18 +892,3 @@ class Note(models.Model): if self.image.name and THUMBNAIL_SIZES: for size in THUMBNAIL_SIZES: self.image.thumbnail = self.image.crop[size].name - - # FIXME: this does not belong here - @staticmethod - def is_editable(note_view_set, note_id): - """ - Whether the given note is assigned to a show the current user owns - @return boolean - """ - - if note_view_set.request.user.is_superuser: - return True - - note = Note.objects.get(pk=note_id) - - return int(note.show_id) in note_view_set.request.user.shows.all().values_list('id', flat=True)