• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

liqd / adhocracy-plus / 18908688697

29 Oct 2025 12:59PM UTC coverage: 44.622% (-44.5%) from 89.135%
18908688697

Pull #2986

github

web-flow
Merge 1dfde8ee7 into 445e1d498
Pull Request #2986: Draft: Speed up Github Ci Tests

3012 of 6750 relevant lines covered (44.62%)

0.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.79
/apps/debate/views.py
1
from django.urls import reverse
1✔
2
from django.utils.translation import gettext_lazy as _
1✔
3

4
from adhocracy4.dashboard import mixins
1✔
5
from adhocracy4.exports.views import DashboardExportView
1✔
6
from adhocracy4.filters import views as filter_views
1✔
7
from adhocracy4.projects.mixins import DisplayProjectOrModuleMixin
1✔
8
from adhocracy4.projects.mixins import ProjectMixin
1✔
9
from apps.ideas import views as idea_views
1✔
10

11
from . import filters
1✔
12
from . import forms
1✔
13
from . import models
1✔
14

15

16
class SubjectListView(idea_views.AbstractIdeaListView, DisplayProjectOrModuleMixin):
1✔
17
    model = models.Subject
1✔
18
    filter_set = filters.SubjectFilterSet
1✔
19

20

21
class SubjectDetailView(idea_views.AbstractIdeaDetailView):
1✔
22
    model = models.Subject
1✔
23
    permission_required = "a4_candy_debate.view_subject"
1✔
24

25

26
class SubjectListDashboardView(
1✔
27
    ProjectMixin,
28
    mixins.DashboardBaseMixin,
29
    mixins.DashboardComponentMixin,
30
    filter_views.FilteredListView,
31
):
32
    model = models.Subject
1✔
33
    template_name = "a4_candy_debate/subject_dashboard_list.html"
1✔
34
    permission_required = "a4projects.change_project"
1✔
35
    filter_set = filters.SubjectCreateFilterSet
1✔
36

37
    def get_queryset(self):
1✔
38
        return super().get_queryset().filter(module=self.module)
×
39

40
    def get_permission_object(self):
1✔
41
        return self.project
×
42

43

44
class SubjectCreateView(
1✔
45
    mixins.DashboardBaseMixin,
46
    mixins.DashboardComponentMixin,
47
    mixins.DashboardComponentFormSignalMixin,
48
    idea_views.AbstractIdeaCreateView,
49
):
50
    model = models.Subject
1✔
51
    form_class = forms.SubjectForm
1✔
52
    permission_required = "a4_candy_debate.add_subject"
1✔
53
    template_name = "a4_candy_debate/subject_create_form.html"
1✔
54

55
    def get_success_url(self):
1✔
56
        return reverse(
×
57
            "a4dashboard:subject-list",
58
            kwargs={
59
                "organisation_slug": self.module.project.organisation.slug,
60
                "module_slug": self.module.slug,
61
            },
62
        )
63

64
    def get_permission_object(self):
1✔
65
        return self.module
×
66

67

68
class SubjectUpdateView(
1✔
69
    mixins.DashboardBaseMixin,
70
    mixins.DashboardComponentMixin,
71
    mixins.DashboardComponentFormSignalMixin,
72
    idea_views.AbstractIdeaUpdateView,
73
):
74
    model = models.Subject
1✔
75
    form_class = forms.SubjectForm
1✔
76
    permission_required = "a4_candy_debate.change_subject"
1✔
77
    template_name = "a4_candy_debate/subject_update_form.html"
1✔
78

79
    @property
1✔
80
    def organisation(self):
1✔
81
        return self.project.organisation
×
82

83
    def get_success_url(self):
1✔
84
        return reverse(
×
85
            "a4dashboard:subject-list",
86
            kwargs={
87
                "organisation_slug": self.module.project.organisation.slug,
88
                "module_slug": self.module.slug,
89
            },
90
        )
91

92
    def get_permission_object(self):
1✔
93
        return self.get_object()
×
94

95

96
class SubjectDeleteView(
1✔
97
    mixins.DashboardBaseMixin,
98
    mixins.DashboardComponentMixin,
99
    mixins.DashboardComponentFormSignalMixin,
100
    idea_views.AbstractIdeaDeleteView,
101
):
102
    model = models.Subject
1✔
103
    success_message = _("The subject has been deleted")
1✔
104
    permission_required = "a4_candy_debate.change_subject"
1✔
105
    template_name = "a4_candy_debate/subject_confirm_delete.html"
1✔
106

107
    @property
1✔
108
    def organisation(self):
1✔
109
        return self.project.organisation
×
110

111
    def get_success_url(self):
1✔
112
        return reverse(
×
113
            "a4dashboard:subject-list",
114
            kwargs={
115
                "organisation_slug": self.module.project.organisation.slug,
116
                "module_slug": self.module.slug,
117
            },
118
        )
119

120
    def get_permission_object(self):
1✔
121
        return self.get_object()
×
122

123

124
class SubjectDashboardExportView(DashboardExportView):
1✔
125
    template_name = "a4exports/export_dashboard.html"
1✔
126

127
    def get_context_data(self, **kwargs):
1✔
128
        context = super().get_context_data(**kwargs)
×
129
        context["subject_export"] = reverse(
×
130
            "a4dashboard:subject-export",
131
            kwargs={
132
                "organisation_slug": self.module.project.organisation.slug,
133
                "module_slug": self.module.slug,
134
            },
135
        )
136
        context["comment_export"] = reverse(
×
137
            "a4dashboard:subject-comment-export",
138
            kwargs={
139
                "organisation_slug": self.module.project.organisation.slug,
140
                "module_slug": self.module.slug,
141
            },
142
        )
143
        return context
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc