scieloorg / core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remodelar Journal, removendo os textos com idiomas para os modelos JournalPolicies e JournalInstructionsToAuthors

robertatakenaka opened this issue · comments

Descrição da tarefa

Estamos experimentando problemas de desempenho. Possível solução é reduzir o modelo Journal, removendo os textos com idiomas para outros modelos, JournalPolicies e JournalInstructionsToAuthors.

A nova modelagem pode ter a seleção de um idioma para um grupo de textos.

Por exemplo, no lugar de:

panels_policy = [
        InlinePanel(
            "ethics",
            label=_("Ethics"),
            classname="collapsed",
        ),
        InlinePanel(
            "ecommittee",
            label=_("Ethics Committee"),
            classname="collapsed",
        ),
        InlinePanel(
            "copyright",
            label=_("Copyright"),
            classname="collapsed",
        ),
]

class Ethics(ClusterableModel, RichTextWithLanguage, CommonControlField):
    journal = ParentalKey(
        Journal, on_delete=models.SET_NULL, related_name="ethics", null=True
    )

class Ecommittee(Orderable, RichTextWithLanguage, CommonControlField):
    rich_text = RichTextField(
        null=True,
        blank=True,
        help_text=_(
            """Authors must attach a statement of approval from the ethics committee of 
            the institution responsible for approving the research"""
        ),
    )
    journal = ParentalKey(
        Journal, on_delete=models.SET_NULL, related_name="ecommittee", null=True
    )

class Copyright(Orderable, RichTextWithLanguage, CommonControlField):
    rich_text = RichTextField(
        null=True,
        blank=True,
        help_text=_(
            """Describe the policy used by the journal on copyright issues. 
            We recommend that this section be in accordance with the recommendations of the SciELO criteria, 
            item 5.2.10.1.2. - Copyright"""
        ),
    )
    journal = ParentalKey(
        Journal, on_delete=models.SET_NULL, related_name="copyright", null=True
    )
panels_policy = [
        InlinePanel(
            "journal_policies",
            label=_("Journal policies"),
            classname="collapsed",
        ),
]

class JournalPolicy(ClusterableModel, CommonControlField):
    journal = ParentalKey(
        Journal, on_delete=models.SET_NULL, related_name="ethics", null=True
    )
   language = models.ForeignKey(
        Language,
        on_delete=models.SET_NULL,
        verbose_name=_("Language"),
        null=True,
        blank=True,
    )
    ethics_statement = RichTextField(_("Ethics statement"), null=True, blank=True)
    ecommittee_statement = RichTextField(_("Ecommittee statement"), null=True, blank=True)
    copyright_statement = RichTextField(_("Copyright statement"), null=True, blank=True)