arthexis 0.1.21__py3-none-any.whl → 0.1.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of arthexis might be problematic. Click here for more details.
- {arthexis-0.1.21.dist-info → arthexis-0.1.23.dist-info}/METADATA +9 -8
- {arthexis-0.1.21.dist-info → arthexis-0.1.23.dist-info}/RECORD +33 -33
- config/settings.py +4 -0
- config/urls.py +5 -0
- core/admin.py +224 -32
- core/environment.py +2 -239
- core/models.py +903 -65
- core/release.py +0 -5
- core/system.py +76 -0
- core/tests.py +181 -9
- core/user_data.py +42 -2
- core/views.py +68 -27
- nodes/admin.py +211 -60
- nodes/apps.py +11 -0
- nodes/models.py +35 -7
- nodes/tests.py +288 -1
- nodes/views.py +101 -48
- ocpp/admin.py +32 -2
- ocpp/consumers.py +1 -0
- ocpp/models.py +52 -3
- ocpp/tasks.py +99 -1
- ocpp/tests.py +350 -2
- ocpp/views.py +300 -6
- pages/admin.py +112 -15
- pages/apps.py +32 -0
- pages/forms.py +31 -8
- pages/models.py +42 -2
- pages/tests.py +386 -28
- pages/urls.py +10 -0
- pages/views.py +347 -18
- {arthexis-0.1.21.dist-info → arthexis-0.1.23.dist-info}/WHEEL +0 -0
- {arthexis-0.1.21.dist-info → arthexis-0.1.23.dist-info}/licenses/LICENSE +0 -0
- {arthexis-0.1.21.dist-info → arthexis-0.1.23.dist-info}/top_level.txt +0 -0
pages/models.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import logging
|
|
3
|
+
from datetime import timedelta
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
from django.db import models
|
|
@@ -7,10 +8,11 @@ from django.db.models import Q
|
|
|
7
8
|
from core.entity import Entity
|
|
8
9
|
from core.models import Lead, SecurityGroup
|
|
9
10
|
from django.contrib.sites.models import Site
|
|
10
|
-
from nodes.models import NodeRole
|
|
11
|
+
from nodes.models import ContentSample, NodeRole
|
|
11
12
|
from django.apps import apps as django_apps
|
|
13
|
+
from django.utils import timezone
|
|
12
14
|
from django.utils.text import slugify
|
|
13
|
-
from django.utils.translation import gettext, gettext_lazy as _
|
|
15
|
+
from django.utils.translation import gettext, gettext_lazy as _, get_language_info
|
|
14
16
|
from importlib import import_module
|
|
15
17
|
from django.urls import URLPattern
|
|
16
18
|
from django.conf import settings
|
|
@@ -490,6 +492,14 @@ class ViewHistory(Entity):
|
|
|
490
492
|
def __str__(self) -> str: # pragma: no cover - simple representation
|
|
491
493
|
return f"{self.method} {self.path} ({self.status_code})"
|
|
492
494
|
|
|
495
|
+
@classmethod
|
|
496
|
+
def purge_older_than(cls, *, days: int) -> int:
|
|
497
|
+
"""Delete history entries recorded more than ``days`` days ago."""
|
|
498
|
+
|
|
499
|
+
cutoff = timezone.now() - timedelta(days=days)
|
|
500
|
+
deleted, _ = cls.objects.filter(visited_at__lt=cutoff).delete()
|
|
501
|
+
return deleted
|
|
502
|
+
|
|
493
503
|
|
|
494
504
|
class Favorite(Entity):
|
|
495
505
|
user = models.ForeignKey(
|
|
@@ -500,9 +510,11 @@ class Favorite(Entity):
|
|
|
500
510
|
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
|
501
511
|
custom_label = models.CharField(max_length=100, blank=True)
|
|
502
512
|
user_data = models.BooleanField(default=False)
|
|
513
|
+
priority = models.IntegerField(default=0)
|
|
503
514
|
|
|
504
515
|
class Meta:
|
|
505
516
|
unique_together = ("user", "content_type")
|
|
517
|
+
ordering = ["priority", "pk"]
|
|
506
518
|
|
|
507
519
|
|
|
508
520
|
class UserStory(Lead):
|
|
@@ -545,6 +557,19 @@ class UserStory(Lead):
|
|
|
545
557
|
blank=True,
|
|
546
558
|
help_text=_("Link to the GitHub issue created for this feedback."),
|
|
547
559
|
)
|
|
560
|
+
screenshot = models.ForeignKey(
|
|
561
|
+
ContentSample,
|
|
562
|
+
on_delete=models.SET_NULL,
|
|
563
|
+
blank=True,
|
|
564
|
+
null=True,
|
|
565
|
+
related_name="user_stories",
|
|
566
|
+
help_text=_("Screenshot captured for this feedback."),
|
|
567
|
+
)
|
|
568
|
+
language_code = models.CharField(
|
|
569
|
+
max_length=15,
|
|
570
|
+
blank=True,
|
|
571
|
+
help_text=_("Language selected when the feedback was submitted."),
|
|
572
|
+
)
|
|
548
573
|
|
|
549
574
|
class Meta:
|
|
550
575
|
ordering = ["-submitted_at"]
|
|
@@ -590,6 +615,21 @@ class UserStory(Lead):
|
|
|
590
615
|
f"**Screenshot requested:** {screenshot_requested}",
|
|
591
616
|
]
|
|
592
617
|
|
|
618
|
+
language_code = (self.language_code or "").strip()
|
|
619
|
+
if language_code:
|
|
620
|
+
normalized = language_code.replace("_", "-").lower()
|
|
621
|
+
try:
|
|
622
|
+
info = get_language_info(normalized)
|
|
623
|
+
except KeyError:
|
|
624
|
+
language_display = ""
|
|
625
|
+
else:
|
|
626
|
+
language_display = info.get("name_local") or info.get("name") or ""
|
|
627
|
+
|
|
628
|
+
if language_display:
|
|
629
|
+
lines.append(f"**Language:** {language_display} ({normalized})")
|
|
630
|
+
else:
|
|
631
|
+
lines.append(f"**Language:** {normalized}")
|
|
632
|
+
|
|
593
633
|
if self.submitted_at:
|
|
594
634
|
lines.append(f"**Submitted at:** {self.submitted_at.isoformat()}")
|
|
595
635
|
|