localcosmos-server 0.24.6__py3-none-any.whl → 0.24.8__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.
- localcosmos_server/api/serializers.py +18 -1
- localcosmos_server/template_content/api/serializers.py +38 -1
- localcosmos_server/template_content/models.py +6 -0
- {localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/METADATA +1 -1
- {localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/RECORD +8 -8
- {localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/WHEEL +0 -0
- {localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/licenses/LICENCE +0 -0
- {localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/top_level.txt +0 -0
|
@@ -409,6 +409,7 @@ class TaxonSerializer(serializers.Serializer):
|
|
|
409
409
|
|
|
410
410
|
|
|
411
411
|
class MorphotypeProfileSerializer(serializers.Serializer):
|
|
412
|
+
|
|
412
413
|
taxonProfileId = serializers.IntegerField(read_only=True)
|
|
413
414
|
parentTaxonProfileId = serializers.IntegerField(read_only=True)
|
|
414
415
|
morphotype = serializers.CharField(read_only=True)
|
|
@@ -416,6 +417,17 @@ class MorphotypeProfileSerializer(serializers.Serializer):
|
|
|
416
417
|
vernacular = serializers.DictField(child=serializers.CharField(read_only=True), read_only=True)
|
|
417
418
|
image = ImageSerializer(read_only=True)
|
|
418
419
|
vernacular = serializers.DictField(child=serializers.CharField(read_only=True), read_only=True)
|
|
420
|
+
link = serializers.CharField(read_only=True)
|
|
421
|
+
|
|
422
|
+
def __init__(self, *args, app=None, **kwargs):
|
|
423
|
+
super().__init__(*args, **kwargs)
|
|
424
|
+
self.app = app
|
|
425
|
+
|
|
426
|
+
def to_representation(self, instance):
|
|
427
|
+
data = instance.copy()
|
|
428
|
+
# this is just a placeholder and work in progress
|
|
429
|
+
data['link'] = 'https://www.beachexplorer.org/arten/tringa-nebularia-cranium/steckbrief'
|
|
430
|
+
return data
|
|
419
431
|
|
|
420
432
|
|
|
421
433
|
class TaxonProfileSerializer(serializers.Serializer):
|
|
@@ -478,6 +490,11 @@ class TaxonProfileSerializer(serializers.Serializer):
|
|
|
478
490
|
|
|
479
491
|
taxon_relationships_serialized.append(tr_serialized)
|
|
480
492
|
|
|
493
|
+
morphotype_profiles = []
|
|
494
|
+
for mp in instance.get('morphotypeProfiles', []):
|
|
495
|
+
mp_serialized = MorphotypeProfileSerializer(mp, app=self.app).data
|
|
496
|
+
morphotype_profiles.append(mp_serialized)
|
|
497
|
+
|
|
481
498
|
data = {
|
|
482
499
|
'taxonLatname': instance['taxonLatname'],
|
|
483
500
|
'taxonAuthor': instance['taxonAuthor'],
|
|
@@ -498,7 +515,7 @@ class TaxonProfileSerializer(serializers.Serializer):
|
|
|
498
515
|
'seo': instance['seo'],
|
|
499
516
|
'externalMedia': instance['externalMedia'],
|
|
500
517
|
'taxonRelationships': taxon_relationships_serialized,
|
|
501
|
-
'morphotypeProfiles':
|
|
518
|
+
'morphotypeProfiles': morphotype_profiles,
|
|
502
519
|
'isFeatured': instance['isFeatured'],
|
|
503
520
|
}
|
|
504
521
|
|
|
@@ -9,8 +9,20 @@ from localcosmos_server.template_content.utils import get_component_image_type,
|
|
|
9
9
|
|
|
10
10
|
# do not replace camelCase with underscore_case without adapting app_kit's ContentImageBuilder.build_licence
|
|
11
11
|
class LocalizedTemplateContentSerializer(serializers.ModelSerializer):
|
|
12
|
+
|
|
13
|
+
uuid = serializers.SerializerMethodField()
|
|
14
|
+
|
|
15
|
+
language = serializers.SerializerMethodField()
|
|
12
16
|
|
|
13
17
|
title = serializers.SerializerMethodField()
|
|
18
|
+
author = serializers.SerializerMethodField()
|
|
19
|
+
|
|
20
|
+
slug = serializers.SerializerMethodField()
|
|
21
|
+
|
|
22
|
+
createdAt = serializers.SerializerMethodField()
|
|
23
|
+
lastModified = serializers.SerializerMethodField()
|
|
24
|
+
publishedAt = serializers.SerializerMethodField()
|
|
25
|
+
|
|
14
26
|
templateName = serializers.SerializerMethodField()
|
|
15
27
|
templatePath = serializers.SerializerMethodField()
|
|
16
28
|
|
|
@@ -36,12 +48,36 @@ class LocalizedTemplateContentSerializer(serializers.ModelSerializer):
|
|
|
36
48
|
else:
|
|
37
49
|
self.template_definition = localized_template_content.template_content.template.definition
|
|
38
50
|
return self.template_definition
|
|
51
|
+
|
|
52
|
+
def get_uuid(self, localized_template_content):
|
|
53
|
+
return str(localized_template_content.template_content.uuid)
|
|
54
|
+
|
|
55
|
+
def get_language(self, localized_template_content):
|
|
56
|
+
return localized_template_content.language
|
|
39
57
|
|
|
40
58
|
def get_title(self, localized_template_content):
|
|
41
59
|
preview = self.context.get('preview', True)
|
|
42
60
|
if preview == True:
|
|
43
61
|
return localized_template_content.draft_title
|
|
44
62
|
return localized_template_content.published_title
|
|
63
|
+
|
|
64
|
+
def get_slug(self, localized_template_content):
|
|
65
|
+
return localized_template_content.slug
|
|
66
|
+
|
|
67
|
+
def get_author(self, localized_template_content):
|
|
68
|
+
preview = self.context.get('preview', True)
|
|
69
|
+
if preview == True:
|
|
70
|
+
return localized_template_content.author
|
|
71
|
+
return localized_template_content.published_author
|
|
72
|
+
|
|
73
|
+
def get_createdAt(self, localized_template_content):
|
|
74
|
+
return localized_template_content.created_at
|
|
75
|
+
|
|
76
|
+
def get_lastModified(self, localized_template_content):
|
|
77
|
+
return localized_template_content.updated_at
|
|
78
|
+
|
|
79
|
+
def get_publishedAt(self, localized_template_content):
|
|
80
|
+
return localized_template_content.published_at
|
|
45
81
|
|
|
46
82
|
def get_templateName(self, localized_template_content):
|
|
47
83
|
return self.get_from_definition(localized_template_content, 'templateName')
|
|
@@ -228,7 +264,8 @@ class LocalizedTemplateContentSerializer(serializers.ModelSerializer):
|
|
|
228
264
|
|
|
229
265
|
class Meta:
|
|
230
266
|
model = LocalizedTemplateContent
|
|
231
|
-
fields = ['title', 'templateName', 'templatePath', 'version', 'contents', 'linkedTaxa', 'linkedTaxonProfiles'
|
|
267
|
+
fields = ['title', 'templateName', 'templatePath', 'version', 'contents', 'linkedTaxa', 'linkedTaxonProfiles',
|
|
268
|
+
'publishedAt', 'createdAt', 'lastModified', 'uuid', 'language', 'slug', 'author']
|
|
232
269
|
|
|
233
270
|
|
|
234
271
|
# do not replace camelCase with underscore_case without adapting app_kit's ContentImageBuilder.build_licence
|
|
@@ -475,6 +475,11 @@ class LocalizedTemplateContent(ServerContentImageMixin, models.Model):
|
|
|
475
475
|
draft_version = models.IntegerField(default=1)
|
|
476
476
|
published_version = models.IntegerField(null=True)
|
|
477
477
|
published_at = models.DateTimeField(null=True)
|
|
478
|
+
|
|
479
|
+
author = models.CharField(max_length=355, null=True, blank=True,
|
|
480
|
+
help_text=_("Author name for attribution (e.g., 'Dr. Jane Smith' or 'LocalCosmos Team')"))
|
|
481
|
+
|
|
482
|
+
published_author = models.CharField(max_length=355, null=True, blank=True)
|
|
478
483
|
|
|
479
484
|
objects = LocalizedTemplateContentManager()
|
|
480
485
|
|
|
@@ -632,6 +637,7 @@ class LocalizedTemplateContent(ServerContentImageMixin, models.Model):
|
|
|
632
637
|
def publish(self):
|
|
633
638
|
# set title
|
|
634
639
|
self.published_title = self.draft_title
|
|
640
|
+
self.published_author = self.author
|
|
635
641
|
self.published_contents = self.draft_contents
|
|
636
642
|
|
|
637
643
|
# currently, images are not translatable. This can change in the future
|
|
@@ -37,7 +37,7 @@ localcosmos_server/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
37
37
|
localcosmos_server/api/anycluster_schema_urls.py,sha256=nVa9-1pf6a1F-LNYaN3im9xy9LkebIxp0eaJs-Bwvok,1219
|
|
38
38
|
localcosmos_server/api/examples.py,sha256=o9MyhwcsOKUI1YstEKQ7bFHM5nrVjy873WQcH_OTL-s,309
|
|
39
39
|
localcosmos_server/api/permissions.py,sha256=HLToMDOGIMYWsRbM1asgw5NUGz7ukABrqGLSJxZEaXI,1303
|
|
40
|
-
localcosmos_server/api/serializers.py,sha256=
|
|
40
|
+
localcosmos_server/api/serializers.py,sha256=WR8w-1W7HpRAp5n4W0QUI5vp4GTuZ74ck0G8E5F-fo4,22096
|
|
41
41
|
localcosmos_server/api/urls.py,sha256=YwGSsvIofYWMPuO1e69VEo2W6oOM6TWU4vrv_Z9DuRk,2282
|
|
42
42
|
localcosmos_server/api/views.py,sha256=1RSz7r5fGs0VC1fmu0VAk6N6BZ3wncv3fxkOVmY3MOM,26686
|
|
43
43
|
localcosmos_server/api/example_files/taxon_profile.json,sha256=SeWCnsAHQejKZoKxBVEelcETd3emYYkuDXjkvJFSUlU,4861
|
|
@@ -2571,13 +2571,13 @@ localcosmos_server/template_content/apps.py,sha256=mDqzbEckEwocaVH58MAzWzTxTvLgC
|
|
|
2571
2571
|
localcosmos_server/template_content/fields.py,sha256=PEfnvewT8voBMgNtHcn5BHx4UCLQNwlG9FL7I6c7KLg,227
|
|
2572
2572
|
localcosmos_server/template_content/forms.py,sha256=aV4sV0zXEZBGwlHWc_IkAdI7GnC5AGAoo_Ga4v7trM8,26438
|
|
2573
2573
|
localcosmos_server/template_content/json_schemas.py,sha256=79BMDGH6daVxBCy9GOoLaBO4yIeVijMMFIjnEHzlZz4,1972
|
|
2574
|
-
localcosmos_server/template_content/models.py,sha256=
|
|
2574
|
+
localcosmos_server/template_content/models.py,sha256=TJ2Q58PIDxRF3fnsDnXEyjKlF0ybStBKTd88nxZW-yI,39054
|
|
2575
2575
|
localcosmos_server/template_content/urls.py,sha256=lC9HXdlG-dV04syWi8lFXH2xpk2K0wS-C834wwqGo70,5583
|
|
2576
2576
|
localcosmos_server/template_content/utils.py,sha256=-qQQTwEiI9J2InPMGehidtgLK_6rt9GBNuCmfCCgujc,1178
|
|
2577
2577
|
localcosmos_server/template_content/views.py,sha256=QlCkPgvwjUn_4AAzwzPa_c6qfLY7Rcy9aV_EhZ9689k,37534
|
|
2578
2578
|
localcosmos_server/template_content/widgets.py,sha256=iNQkktV_Fk7VZre-Jpy_tF03a7-PUL5XDVZ1YH5dNBQ,1775
|
|
2579
2579
|
localcosmos_server/template_content/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2580
|
-
localcosmos_server/template_content/api/serializers.py,sha256=
|
|
2580
|
+
localcosmos_server/template_content/api/serializers.py,sha256=FaRncSmm9Eo1TRLoMoJEhi-NA1ElXMyyb61o39gcwLw,12511
|
|
2581
2581
|
localcosmos_server/template_content/api/urls.py,sha256=JPngLtzbQ0K2w3Wpq4O3RnvmSBCzTuNTcbIPkSO-QIE,893
|
|
2582
2582
|
localcosmos_server/template_content/api/views.py,sha256=aVei450Ugi6XRrlssIzDkvthDzN5j2dqBYGEnwV9i2s,2538
|
|
2583
2583
|
localcosmos_server/template_content/migrations/0001_initial.py,sha256=nABlB8A9ezsSXjYaYuv2Ks2gl8k3mB2Zwh8z0KDb1G8,3430
|
|
@@ -2776,8 +2776,8 @@ localcosmos_server/tests/mixins.py,sha256=2k-zCrqndwQLABNULDWRftROij3kwhW_bTiV6r
|
|
|
2776
2776
|
localcosmos_server/tests/test_forms.py,sha256=axF1v-T0NGR16St3hueQAuREb2sbWzajdNFQDpFeYqI,9767
|
|
2777
2777
|
localcosmos_server/tests/test_models.py,sha256=h4d70Ps0hLbcgL6rL1OV_6zxJ_ewDfHgvzJTJDw1m6E,33000
|
|
2778
2778
|
localcosmos_server/tests/test_views.py,sha256=SaEuAFAfapsSJi1_R6WEgp41MB03sPruCIy_hJ_oGwc,4308
|
|
2779
|
-
localcosmos_server-0.24.
|
|
2780
|
-
localcosmos_server-0.24.
|
|
2781
|
-
localcosmos_server-0.24.
|
|
2782
|
-
localcosmos_server-0.24.
|
|
2783
|
-
localcosmos_server-0.24.
|
|
2779
|
+
localcosmos_server-0.24.8.dist-info/licenses/LICENCE,sha256=VnxALPSxXoU59rlNeRdJtwS_nU79IFpVWsZZCQUM4Mw,1086
|
|
2780
|
+
localcosmos_server-0.24.8.dist-info/METADATA,sha256=FBEwZPRiQCBsAVyp5aM-Tw3nzJDfzTLzDBl8cOsIc6c,1686
|
|
2781
|
+
localcosmos_server-0.24.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
2782
|
+
localcosmos_server-0.24.8.dist-info/top_level.txt,sha256=hNVjlPGCtXvUF5CJY5HOFA_Dh5fYivfqVSyFMUDkqPY,19
|
|
2783
|
+
localcosmos_server-0.24.8.dist-info/RECORD,,
|
|
File without changes
|
{localcosmos_server-0.24.6.dist-info → localcosmos_server-0.24.8.dist-info}/licenses/LICENCE
RENAMED
|
File without changes
|
|
File without changes
|