wbwriter 1.49.0__tar.gz → 1.49.1__tar.gz
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.
- {wbwriter-1.49.0 → wbwriter-1.49.1}/PKG-INFO +1 -1
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/article.py +5 -4
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/article.py +3 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/article.py +8 -6
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/article.py +3 -15
- {wbwriter-1.49.0 → wbwriter-1.49.1}/.gitignore +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/pyproject.toml +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/admin.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/apps.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/dynamic_preferences_registry.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/factories/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/factories/article.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/factories/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/filters/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/filters/article.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/filters/metainformationinstance.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/0001_initial_squashed_squashed_0008_alter_article_author_alter_article_feedback_contact_and_more.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/0009_dependantarticle.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/0010_alter_article_options.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/0011_auto_20240103_0953.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/0012_i18n.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/migrations/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/article_type.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/block.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/block_parameter.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/in_editor_template.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/mixins.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/publication_models.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/style.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/models/template.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/pdf_generator.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/publication_parser.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/article_type.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/in_editor_template.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/serializers/publication.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/article_pdf.html +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/templatetags/cite_article.html +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/templatetags/table_of_contents.html +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/templatetags/table_of_contents_articles.html +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templatetags/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templatetags/writer.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/conftest.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/signals.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/test_filter.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/test_model.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/test_writer.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/tests/tests.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/typings.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/urls.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/article_type.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/buttons.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/article_type.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/in_editor_template.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/meta_information_instance.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/display/publication.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/documentation/article.md +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/endpoints/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/endpoints/article.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/endpoints/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/in_editor_template.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/menu.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/meta_information.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/meta_information_instance.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/publication.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/titles/__init__.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/titles/publication_title_config.py +0 -0
- {wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/titles/reviewer_article_title_config.py +0 -0
|
@@ -13,6 +13,7 @@ from django.core.files.base import ContentFile
|
|
|
13
13
|
from django.db import models
|
|
14
14
|
from django.db.models import Count, Max, OuterRef, Subquery
|
|
15
15
|
from django.db.models.functions import Coalesce
|
|
16
|
+
from django.utils.translation import gettext_lazy
|
|
16
17
|
from django_fsm import FSMField, transition
|
|
17
18
|
from dynamic_preferences.registries import global_preferences_registry
|
|
18
19
|
from modeltrans.fields import TranslationField
|
|
@@ -771,14 +772,14 @@ class Article(CloneMixin, TagModelMixin, PublishableMixin, WBModel):
|
|
|
771
772
|
"""Allow only one-off and deep-dive articles to be published."""
|
|
772
773
|
errors = dict()
|
|
773
774
|
if self.status not in [self.Status.APPROVED, self.Status.PUBLISHED]:
|
|
774
|
-
errors["status"] = "Status needs to be approved in order to allow publication"
|
|
775
|
+
errors["status"] = [gettext_lazy("Status needs to be approved in order to allow publication")]
|
|
775
776
|
if not self.type or self.type.slug not in [
|
|
776
777
|
"one-off-article",
|
|
777
778
|
"deep-dive-article",
|
|
778
779
|
"mid-year-review",
|
|
779
780
|
"year-s-favorites",
|
|
780
781
|
]:
|
|
781
|
-
errors["type"] = "unvalid type for publication"
|
|
782
|
+
errors["type"] = [gettext_lazy("unvalid type for publication")]
|
|
782
783
|
# We ensure the article's parser can be published
|
|
783
784
|
if article_type := self.type:
|
|
784
785
|
for parser in article_type.parsers.all():
|
|
@@ -788,9 +789,9 @@ class Article(CloneMixin, TagModelMixin, PublishableMixin, WBModel):
|
|
|
788
789
|
date.today(),
|
|
789
790
|
).is_valid()
|
|
790
791
|
except ParserValidationException as e:
|
|
791
|
-
errors["non_field_errors"] =
|
|
792
|
+
errors["non_field_errors"] = e.errors
|
|
792
793
|
except ModuleNotFoundError:
|
|
793
|
-
errors["non_field_errors"] = "invalid parser"
|
|
794
|
+
errors["non_field_errors"] = [gettext_lazy("invalid parser")]
|
|
794
795
|
return errors
|
|
795
796
|
|
|
796
797
|
def can_be_published(self) -> bool:
|
|
@@ -243,6 +243,8 @@ def _get_plugin_configs(request):
|
|
|
243
243
|
class ArticleFullModelSerializer(ArticleModelSerializer):
|
|
244
244
|
"""Serializes the full set of the fields of of the Article model."""
|
|
245
245
|
|
|
246
|
+
is_private_icon = wb_serializers.IconSelectField(read_only=True)
|
|
247
|
+
|
|
246
248
|
author = wb_serializers.PrimaryKeyRelatedField(
|
|
247
249
|
many=False,
|
|
248
250
|
label="Author",
|
|
@@ -337,6 +339,7 @@ class ArticleFullModelSerializer(ArticleModelSerializer):
|
|
|
337
339
|
model = Article
|
|
338
340
|
fields = (
|
|
339
341
|
"id",
|
|
342
|
+
"is_private_icon",
|
|
340
343
|
"name",
|
|
341
344
|
"title",
|
|
342
345
|
"slug",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from django.contrib.contenttypes.models import ContentType
|
|
2
|
-
from django.db.models import Q, QuerySet
|
|
2
|
+
from django.db.models import Case, Q, QuerySet, Value, When
|
|
3
3
|
from django.shortcuts import get_object_or_404
|
|
4
4
|
from django.utils.functional import cached_property
|
|
5
5
|
from rest_framework import status
|
|
@@ -9,6 +9,7 @@ from reversion.views import RevisionMixin
|
|
|
9
9
|
from wbcore.contrib.authentication.authentication import JWTCookieAuthentication
|
|
10
10
|
from wbcore.contrib.directory.models import Person
|
|
11
11
|
from wbcore.contrib.i18n.viewsets import ModelTranslateMixin
|
|
12
|
+
from wbcore.contrib.icons import WBIcon
|
|
12
13
|
from wbcore.utils.views import CloneMixin
|
|
13
14
|
from wbcore.viewsets import ModelViewSet, RepresentationViewSet
|
|
14
15
|
|
|
@@ -106,7 +107,9 @@ class ArticleModelViewSet(
|
|
|
106
107
|
# LIST_DOCUMENTATION = "wbwriter/viewsets/documentation/article.md"
|
|
107
108
|
|
|
108
109
|
serializer_class = ArticleFullModelSerializer
|
|
109
|
-
queryset = Article.objects.
|
|
110
|
+
queryset = Article.objects.annotate(
|
|
111
|
+
is_private_icon=Case(When(is_private=False, then=Value(WBIcon.VIEW.icon)), default=Value(WBIcon.IGNORE.icon))
|
|
112
|
+
)
|
|
110
113
|
|
|
111
114
|
button_config_class = ArticleModelButtonConfig
|
|
112
115
|
display_config_class = ArticleDisplayConfig
|
|
@@ -139,10 +142,9 @@ class ArticleModelViewSet(
|
|
|
139
142
|
return ContentType.objects.get(app_label="wbwriter", model="article")
|
|
140
143
|
|
|
141
144
|
def get_queryset(self):
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
qs = Article.objects.filter(is_private=False)
|
|
145
|
+
qs = super().get_queryset()
|
|
146
|
+
if not self.request.user.has_perm("wbwriter.administrate_article") and not self.profile.is_internal:
|
|
147
|
+
qs = qs.filter(is_private=False)
|
|
146
148
|
return qs.select_related(
|
|
147
149
|
"type", "feedback_contact", "reviewer", "peer_reviewer", "qa_reviewer", "author"
|
|
148
150
|
).prefetch_related("tags")
|
|
@@ -3,7 +3,7 @@ from typing import Optional
|
|
|
3
3
|
from django.utils.translation import gettext as _
|
|
4
4
|
from wbcore.contrib.color.enums import WBColor
|
|
5
5
|
from wbcore.contrib.icons import WBIcon
|
|
6
|
-
from wbcore.enums import Operator
|
|
6
|
+
from wbcore.enums import Operator, Unit
|
|
7
7
|
from wbcore.metadata.configs import display as dp
|
|
8
8
|
from wbcore.metadata.configs.display.instance_display import (
|
|
9
9
|
Display,
|
|
@@ -264,6 +264,7 @@ class ArticleDisplayConfig(DisplayViewConfig):
|
|
|
264
264
|
"""Sets up and returns the list display for Article."""
|
|
265
265
|
return dp.ListDisplay(
|
|
266
266
|
fields=[
|
|
267
|
+
dp.Field(key="is_private_icon", label=" ", width=Unit.PIXEL(40)),
|
|
267
268
|
dp.Field(key="id", label=_("ID")),
|
|
268
269
|
dp.Field(key="title", label=_("Title")),
|
|
269
270
|
dp.Field(key="teaser_image", label=_("Teaser image")),
|
|
@@ -330,20 +331,7 @@ class ArticleDisplayConfig(DisplayViewConfig):
|
|
|
330
331
|
),
|
|
331
332
|
],
|
|
332
333
|
column="status",
|
|
333
|
-
)
|
|
334
|
-
dp.Formatting(
|
|
335
|
-
formatting_rules=[
|
|
336
|
-
dp.FormattingRule(
|
|
337
|
-
icon=WBIcon.IGNORE.icon,
|
|
338
|
-
condition=("==", True),
|
|
339
|
-
),
|
|
340
|
-
dp.FormattingRule(
|
|
341
|
-
icon=WBIcon.VIEW.icon,
|
|
342
|
-
condition=("==", False),
|
|
343
|
-
),
|
|
344
|
-
],
|
|
345
|
-
column="is_private",
|
|
346
|
-
),
|
|
334
|
+
)
|
|
347
335
|
],
|
|
348
336
|
legends=[
|
|
349
337
|
dp.Legend(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/templatetags/cite_article.html
RENAMED
|
File without changes
|
{wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/templates/wbwriter/templatetags/table_of_contents.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wbwriter-1.49.0 → wbwriter-1.49.1}/wbwriter/viewsets/titles/reviewer_article_title_config.py
RENAMED
|
File without changes
|