• 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

83.33
/apps/topicprio/models.py
1
from autoslug import AutoSlugField
1✔
2
from django.contrib.contenttypes.fields import GenericRelation
1✔
3
from django.db import models
1✔
4
from django.urls import reverse
1✔
5
from django.utils.translation import gettext_lazy as _
1✔
6
from django_ckeditor_5.fields import CKEditor5Field
1✔
7

8
from adhocracy4 import transforms
1✔
9
from adhocracy4.categories.fields import CategoryField
1✔
10
from adhocracy4.comments import models as comment_models
1✔
11
from adhocracy4.images.fields import ConfiguredImageField
1✔
12
from adhocracy4.images.validators import ImageAltTextValidator
1✔
13
from adhocracy4.labels import models as labels_models
1✔
14
from adhocracy4.models import query
1✔
15
from adhocracy4.modules import models as module_models
1✔
16
from adhocracy4.ratings import models as rating_models
1✔
17

18

19
class TopicQuerySet(query.RateableQuerySet, query.CommentableQuerySet):
1✔
20
    pass
1✔
21

22

23
class Topic(module_models.Item):
1✔
24
    item_ptr = models.OneToOneField(
1✔
25
        to=module_models.Item,
26
        parent_link=True,
27
        related_name="%(app_label)s_%(class)s",
28
        on_delete=models.CASCADE,
29
    )
30
    slug = AutoSlugField(populate_from="name", unique=True)
1✔
31
    name = models.CharField(max_length=120, verbose_name=_("Title"))
1✔
32
    description = CKEditor5Field(
1✔
33
        config_name="image-editor",
34
        verbose_name=_("Description"),
35
        validators=[ImageAltTextValidator()],
36
    )
37
    image = ConfiguredImageField(
1✔
38
        "idea_image",
39
        verbose_name=_("Add image"),
40
        upload_to="ideas/images",
41
        blank=True,
42
    )
43
    ratings = GenericRelation(
1✔
44
        rating_models.Rating, related_query_name="topic", object_id_field="object_pk"
45
    )
46
    comments = GenericRelation(
1✔
47
        comment_models.Comment, related_query_name="topic", object_id_field="object_pk"
48
    )
49
    category = CategoryField()
1✔
50

51
    labels = models.ManyToManyField(
1✔
52
        labels_models.Label,
53
        verbose_name=_("Labels"),
54
        related_name=("%(app_label)s_" "%(class)s_label"),
55
    )
56

57
    objects = TopicQuerySet.as_manager()
1✔
58

59
    class Meta:
1✔
60
        ordering = ["-created"]
1✔
61

62
    @property
1✔
63
    def reference_number(self):
1✔
64
        return "{:d}-{:05d}".format(self.created.year, self.pk)
×
65

66
    def __str__(self):
1✔
67
        return self.name
×
68

69
    def save(self, update_fields=None, *args, **kwargs):
1✔
70
        self.description = transforms.clean_html_field(self.description, "image-editor")
×
71
        if update_fields:
×
72
            update_fields = {"description"}.union(update_fields)
×
73
        super().save(update_fields=update_fields, *args, **kwargs)
×
74

75
    def get_absolute_url(self):
1✔
76
        return reverse(
×
77
            "a4_candy_topicprio:topic-detail",
78
            kwargs=dict(
79
                organisation_slug=self.project.organisation.slug,
80
                pk="{:05d}".format(self.pk),
81
                year=self.created.year,
82
            ),
83
        )
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