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

liqd / a4-defakts / 9386345340

05 Jun 2024 02:46PM UTC coverage: 88.018% (-0.1%) from 88.126%
9386345340

push

github

goapunk
apps/ai_reports: connect with external API

- add a celery task which sends a comment to the XAI server and saves
  the response as AiReport
- connect comment post_save signal with celery task
- rename category to label to be in line with the XAI response
- change AiReport fields to JSONField for now
- add tests
- **BREAKING CHANGE** Reset migrations for the ai_reports app (see
  changelog)

37 of 56 new or added lines in 5 files covered. (66.07%)

113 existing lines in 23 files now uncovered.

5972 of 6785 relevant lines covered (88.02%)

0.88 hits per line

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

90.48
/apps/projects/admin.py
1
from django.contrib import admin
1✔
2
from django.utils.translation import gettext_lazy as _
1✔
3

4
from adhocracy4.projects import models
1✔
5
from adhocracy4.projects.admin import ProjectAdminForm
1✔
6

7

8
@admin.action(description=_("archive"))
1✔
9
def set_is_archived_true(modeladmin, request, queryset):
1✔
UNCOV
10
    queryset.update(is_archived=True)
×
11

12

13
@admin.action(description=_("dearchive"))
1✔
14
def set_is_archived_false(modeladmin, request, queryset):
1✔
UNCOV
15
    queryset.update(is_archived=False)
×
16

17

18
class ProjectAdmin(admin.ModelAdmin):
1✔
19
    form = ProjectAdminForm
1✔
20
    list_display = ("__str__", "organisation", "is_draft", "is_archived", "created")
1✔
21
    list_filter = ("is_draft", "is_archived", "organisation", "is_app_accessible")
1✔
22
    search_fields = ("name",)
1✔
23
    raw_id_fields = ("moderators", "participants")
1✔
24
    date_hierarchy = "created"
1✔
25

26
    actions = [
1✔
27
        set_is_archived_true,
28
        set_is_archived_false,
29
    ]
30

31
    fieldsets = (
1✔
32
        (None, {"fields": ("name", "slug", "organisation")}),
33
        (
34
            _("Information and result"),
35
            {
36
                "fields": ("description", "information", "result"),
37
            },
38
        ),
39
        (
40
            _("Settings"),
41
            {
42
                "classes": ("collapse",),
43
                "fields": (
44
                    "access",
45
                    "is_draft",
46
                    "is_archived",
47
                    "is_app_accessible",
48
                    "moderators",
49
                    "participants",
50
                ),
51
            },
52
        ),
53
        (
54
            _("Images"),
55
            {
56
                "classes": ("collapse",),
57
                "fields": (
58
                    "image",
59
                    "image_copyright",
60
                    "tile_image",
61
                    "tile_image_copyright",
62
                ),
63
            },
64
        ),
65
        (
66
            _("Contact"),
67
            {
68
                "classes": ("collapse",),
69
                "fields": (
70
                    "contact_name",
71
                    "contact_address_text",
72
                    "contact_phone",
73
                    "contact_email",
74
                    "contact_url",
75
                ),
76
            },
77
        ),
78
    )
79

80

81
# Overwrite adhocracy4.projects.admin
82
admin.site.unregister(models.Project)
1✔
83
admin.site.register(models.Project, ProjectAdmin)
1✔
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

© 2026 Coveralls, Inc