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

rafalp / Misago / 17496798327

05 Sep 2025 02:59PM UTC coverage: 96.509% (-0.3%) from 96.769%
17496798327

Pull #1995

github

web-flow
Merge 17284d7d7 into 6bb938c90
Pull Request #1995: Move `Post` model from `misago.threads` to `misago.posts`

1884 of 1974 new or added lines in 149 files covered. (95.44%)

305 existing lines in 16 files now uncovered.

66716 of 69129 relevant lines covered (96.51%)

0.97 hits per line

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

71.88
/misago/threads/models/attachmenttype.py
1
from django.db import models
1✔
2
from django.utils.translation import pgettext_lazy
1✔
3

4
from ...plugins.models import PluginDataModel
1✔
5

6

7
class AttachmentType(PluginDataModel):
1✔
8
    ENABLED = 0
1✔
9
    LOCKED = 1
1✔
10
    DISABLED = 2
1✔
11

12
    name = models.CharField(max_length=255)
1✔
13
    extensions = models.CharField(max_length=255)
1✔
14
    mimetypes = models.CharField(null=True, blank=True, max_length=255)
1✔
15
    size_limit = models.PositiveIntegerField(default=1024)
1✔
16
    status = models.PositiveIntegerField(
1✔
17
        default=ENABLED,
18
        choices=[
19
            (
20
                ENABLED,
21
                pgettext_lazy(
22
                    "attachment availability choice",
23
                    "Allow uploads and downloads",
24
                ),
25
            ),
26
            (
27
                LOCKED,
28
                pgettext_lazy(
29
                    "attachment availability choice",
30
                    "Allow downloads only",
31
                ),
32
            ),
33
            (
34
                DISABLED,
35
                pgettext_lazy(
36
                    "attachment availability choice",
37
                    "Disallow both uploading and downloading",
38
                ),
39
            ),
40
        ],
41
    )
42

43
    limit_uploads_to = models.ManyToManyField(
1✔
44
        "misago_acl.Role", related_name="+", blank=True
45
    )
46
    limit_downloads_to = models.ManyToManyField(
1✔
47
        "misago_acl.Role", related_name="+", blank=True
48
    )
49

50
    def __str__(self):
1✔
51
        return self.name
×
52

53
    @property
1✔
54
    def is_enabled(self):
1✔
55
        return self.status == AttachmentType.ENABLED
×
56

57
    @property
1✔
58
    def is_locked(self):
1✔
59
        return self.status == AttachmentType.LOCKED
×
60

61
    @property
1✔
62
    def extensions_list(self):
1✔
UNCOV
63
        if self.extensions:
×
UNCOV
64
            return self.extensions.split(",")
×
65
        return []
×
66

67
    @property
1✔
68
    def mimetypes_list(self):
1✔
69
        if self.mimetypes:
×
70
            return self.mimetypes.split(",")
×
71
        return []
×
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