Converted python2-style super calls to python3
parent
493924c162
commit
32bad1aaeb
|
@ -20,7 +20,7 @@ def patch_api_view():
|
|||
return Response({'detail': 'Not authenticated'},
|
||||
status=status.HTTP_401_UNAUTHORIZED,
|
||||
exception=True)
|
||||
return super(APIView, self).handle_exception(exc)
|
||||
return super().handle_exception(exc)
|
||||
|
||||
@classmethod
|
||||
def as_view(cls, **initkwargs):
|
||||
|
|
|
@ -23,7 +23,7 @@ class RoleAdmin(admin.ModelAdmin):
|
|||
# Avoid a major performance hit resolving permission names which
|
||||
# triggers a content_type load:
|
||||
kwargs['queryset'] = qs.select_related('content_type')
|
||||
return super(RoleAdmin, self).formfield_for_manytomany(
|
||||
return super().formfield_for_manytomany(
|
||||
db_field, request=request, **kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -46,14 +46,14 @@ class ProjectViewSet(ModelCrudViewSet):
|
|||
return Response(get_all_tags(project))
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(ProjectViewSet, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
qs = qs.filter(Q(owner=self.request.user) |
|
||||
Q(members=self.request.user))
|
||||
return qs.distinct()
|
||||
|
||||
def pre_save(self, obj):
|
||||
obj.owner = self.request.user
|
||||
super(ProjectViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
|
||||
class MembershipViewSet(ModelCrudViewSet):
|
||||
|
|
|
@ -45,5 +45,5 @@ class Document(models.Model):
|
|||
def save(self, *args, **kwargs):
|
||||
if not self.slug:
|
||||
self.slug = slugify(self.title, self.__class__)
|
||||
super(Document, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class IssueViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
|||
def pre_save(self, obj):
|
||||
if not obj.id:
|
||||
obj.owner = self.request.user
|
||||
super(IssueViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
def pre_conditions_on_save(self, obj):
|
||||
super().pre_conditions_on_save(obj)
|
||||
|
@ -112,7 +112,7 @@ class IssueAttachmentViewSet(ModelCrudViewSet):
|
|||
|
||||
def get_queryset(self):
|
||||
ct = ContentType.objects.get_for_model(models.Issue)
|
||||
qs = super(IssueAttachmentViewSet, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
qs = qs.filter(content_type=ct)
|
||||
return qs.distinct()
|
||||
|
||||
|
@ -120,7 +120,7 @@ class IssueAttachmentViewSet(ModelCrudViewSet):
|
|||
if not obj.id:
|
||||
obj.content_type = ContentType.objects.get_for_model(models.Issue)
|
||||
obj.owner = self.request.user
|
||||
super(IssueAttachmentViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
def pre_conditions_on_save(self, obj):
|
||||
super().pre_conditions_on_save(obj)
|
||||
|
|
|
@ -67,7 +67,7 @@ class Milestone(WatchedMixin):
|
|||
if not self.slug:
|
||||
self.slug = slugify_uniquely(self.name, self.__class__)
|
||||
|
||||
super(Milestone, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def _get_user_stories_points(self, user_stories):
|
||||
role_points = [us.role_points.all() for us in user_stories]
|
||||
|
|
|
@ -170,7 +170,7 @@ class Project(models.Model):
|
|||
if not self.slug:
|
||||
self.slug = slugify_uniquely(self.name, self.__class__)
|
||||
|
||||
super(Project, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def get_roles(self):
|
||||
role_model = get_model("users", "Role")
|
||||
|
|
|
@ -27,12 +27,12 @@ class QuestionAttachmentViewSet(ModelCrudViewSet):
|
|||
|
||||
def get_queryset(self):
|
||||
ct = ContentType.objects.get_for_model(models.Question)
|
||||
qs = super(QuestionAttachmentViewSet, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
qs = qs.filter(content_type=ct)
|
||||
return qs.distinct()
|
||||
|
||||
def pre_save(self, obj):
|
||||
super(QuestionAttachmentViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
if not obj.id:
|
||||
obj.content_type = ContentType.objects.get_for_model(models.Question)
|
||||
obj.owner = self.request.user
|
||||
|
@ -49,7 +49,7 @@ class QuestionViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
|||
destroy_notification_template = "destroy_question_notification"
|
||||
|
||||
def pre_save(self, obj):
|
||||
super(QuestionViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
if not obj.id:
|
||||
obj.owner = self.request.user
|
||||
|
||||
|
@ -58,4 +58,4 @@ class QuestionViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
|||
if "comment" in self.request.DATA:
|
||||
# Update the comment in the last version
|
||||
reversion.set_comment(self.request.DATA["comment"])
|
||||
super(QuestionViewSet, self).post_save(obj, created)
|
||||
super().post_save(obj, created)
|
||||
|
|
|
@ -29,7 +29,7 @@ class TaskAttachmentViewSet(ModelCrudViewSet):
|
|||
|
||||
def get_queryset(self):
|
||||
ct = ContentType.objects.get_for_model(models.Task)
|
||||
qs = super(TaskAttachmentViewSet, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
qs = qs.filter(content_type=ct)
|
||||
return qs.distinct()
|
||||
|
||||
|
@ -37,7 +37,7 @@ class TaskAttachmentViewSet(ModelCrudViewSet):
|
|||
if not obj.id:
|
||||
obj.content_type = ContentType.objects.get_for_model(models.Task)
|
||||
obj.owner = self.request.user
|
||||
super(TaskAttachmentViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
def pre_conditions_on_save(self, obj):
|
||||
super().pre_conditions_on_save(obj)
|
||||
|
@ -65,7 +65,7 @@ class TaskViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
|||
obj.milestone = obj.user_story.milestone
|
||||
if not obj.id:
|
||||
obj.owner = self.request.user
|
||||
super(TaskViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
def pre_conditions_on_save(self, obj):
|
||||
super().pre_conditions_on_save(obj)
|
||||
|
@ -88,4 +88,4 @@ class TaskViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
|||
if "comment" in self.request.DATA:
|
||||
# Update the comment in the last version
|
||||
reversion.set_comment(self.request.DATA["comment"])
|
||||
super(TaskViewSet, self).post_save(obj, created)
|
||||
super().post_save(obj, created)
|
||||
|
|
|
@ -26,7 +26,7 @@ class WikiAttachmentViewSet(ModelCrudViewSet):
|
|||
|
||||
def get_queryset(self):
|
||||
ct = ContentType.objects.get_for_model(models.WikiPage)
|
||||
qs = super(WikiAttachmentViewSet, self).get_queryset()
|
||||
qs = super().get_queryset()
|
||||
qs = qs.filter(content_type=ct)
|
||||
return qs.distinct()
|
||||
|
||||
|
@ -43,7 +43,7 @@ class WikiAttachmentViewSet(ModelCrudViewSet):
|
|||
obj.content_type = ContentType.objects.get_for_model(models.WikiPage)
|
||||
obj.owner = self.request.user
|
||||
|
||||
super(WikiAttachmentViewSet, self).pre_save(obj)
|
||||
super().pre_save(obj)
|
||||
|
||||
|
||||
class WikiViewSet(ModelCrudViewSet):
|
||||
|
|
Loading…
Reference in New Issue