Skip to content

Commit

Permalink
Merge pull request #797 from samuelveigarangel/new-issue-789
Browse files Browse the repository at this point in the history
Realiza adições e alterações no formulário de Journal
  • Loading branch information
samuelveigarangel authored Jul 1, 2024
2 parents 1b49fa5 + 0047c46 commit 8729a86
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 2 deletions.
183 changes: 183 additions & 0 deletions journal/migrations/0026_editorialpolicy_opensciencecompliance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Generated by Django 5.0.3 on 2024-07-01 06:09

import django.db.models.deletion
import modelcluster.fields
import wagtail.fields
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("core", "0003_gender_created_gender_creator_gender_updated_and_more"),
("journal", "0025_journalurl"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="EditorialPolicy",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"created",
models.DateTimeField(
auto_now_add=True, verbose_name="Creation date"
),
),
(
"updated",
models.DateTimeField(
auto_now=True, verbose_name="Last update date"
),
),
(
"rich_text",
wagtail.fields.RichTextField(
blank=True, null=True, verbose_name="Rich Text"
),
),
(
"creator",
models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)s_creator",
to=settings.AUTH_USER_MODEL,
verbose_name="Creator",
),
),
(
"journal",
modelcluster.fields.ParentalKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="editorial_policy",
to="journal.journal",
),
),
(
"language",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="core.language",
verbose_name="Idioma",
),
),
(
"updated_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)s_last_mod_user",
to=settings.AUTH_USER_MODEL,
verbose_name="Updater",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
),
migrations.CreateModel(
name="OpenScienceCompliance",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"created",
models.DateTimeField(
auto_now_add=True, verbose_name="Creation date"
),
),
(
"updated",
models.DateTimeField(
auto_now=True, verbose_name="Last update date"
),
),
(
"rich_text",
wagtail.fields.RichTextField(
blank=True, null=True, verbose_name="Rich Text"
),
),
(
"creator",
models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)s_creator",
to=settings.AUTH_USER_MODEL,
verbose_name="Creator",
),
),
(
"journal",
modelcluster.fields.ParentalKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="open_science_compliance",
to="journal.journal",
),
),
(
"language",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="core.language",
verbose_name="Idioma",
),
),
(
"updated_by",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)s_last_mod_user",
to=settings.AUTH_USER_MODEL,
verbose_name="Updater",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
),
]
32 changes: 30 additions & 2 deletions journal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ def autocomplete_label(self):
panels_scope_and_about = [
AutocompletePanel("indexed_at"),
AutocompletePanel("additional_indexed_at"),
FieldPanel("subject"),
AutocompletePanel("subject"),
AutocompletePanel("subject_descriptor"),
InlinePanel("thematic_area", label=_("Thematic Areas"), classname="collapsed"),
FieldPanel("wos_db"),
AutocompletePanel("wos_db"),
AutocompletePanel("wos_area"),
InlinePanel("mission", label=_("Mission"), classname="collapsed"),
InlinePanel("history", label=_("Brief History"), classname="collapsed"),
Expand Down Expand Up @@ -636,6 +636,7 @@ def autocomplete_label(self):
InlinePanel("open_data", label=_("Open data"), classname="collapsed"),
InlinePanel("preprint", label=_("Preprint"), classname="collapsed"),
InlinePanel("review", label=_("Peer review"), classname="collapsed"),
InlinePanel("open_science_compliance", label=_("Open Science Compliance"), classname="collapsed"),
]

panels_policy = [
Expand Down Expand Up @@ -695,6 +696,11 @@ def autocomplete_label(self):
label=_("Fee Charging"),
classname="collapsed",
),
InlinePanel(
"editorial_policy",
label=_("Editorial Policy"),
classname="collapsed",
),
]
panels_notes = [InlinePanel("annotation", label=_("Notes"), classname="collapsed")]

Expand Down Expand Up @@ -1812,6 +1818,11 @@ def get_or_create(
class Subject(CommonControlField):
code = models.CharField(max_length=30, null=True, blank=True)
value = models.CharField(max_length=100, null=True, blank=True)

autocomplete_search_field = "value"

def autocomplete_label(self):
return str(self)

def __str__(self):
return f"{self.value}"
Expand Down Expand Up @@ -1857,6 +1868,11 @@ class WebOfKnowledge(CommonControlField):
code = models.CharField(max_length=8, null=True, blank=True)
value = models.CharField(max_length=100, null=True, blank=True)

autocomplete_search_field = "value"

def autocomplete_label(self):
return str(self)

def __str__(self):
return f"{self.code} - {self.value}"

Expand Down Expand Up @@ -2687,4 +2703,16 @@ class JournalURL(CommonControlField):
null=True,
blank=True,
help_text=_("If the journal is published in another site, enter in this field the other site location"),
)


class EditorialPolicy(Orderable, RichTextWithLanguage, CommonControlField):
journal = ParentalKey(
Journal, on_delete=models.SET_NULL, related_name="editorial_policy", null=True
)


class OpenScienceCompliance(Orderable, RichTextWithLanguage, CommonControlField):
journal = ParentalKey(
Journal, on_delete=models.SET_NULL, related_name="open_science_compliance", null=True
)

0 comments on commit 8729a86

Please sign in to comment.