-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create file article pmc #835
Changes from all commits
ba5a2f8
15f8154
ab04244
eac2ace
9caa460
eab3b91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -828,3 +828,43 @@ def generate_formats(cls, user, article): | |
pmc.pipeline_pmc, | ||
indexed_check=False, | ||
) | ||
|
||
|
||
class ArticleStatusSubmission(Article): | ||
class Meta: | ||
proxy = True | ||
|
||
panels = [ | ||
InlinePanel("article_pubmed_pmc"), | ||
InlinePanel("article_pubmed"), | ||
] | ||
|
||
|
||
def article_directory_path_pubmed_pmc(instance, filename): | ||
try: | ||
return os.path.join( | ||
*instance.article.sps_pkg_name.split("-"), instance.format_name, filename | ||
) | ||
except AttributeError: | ||
return os.path.join(instance.article.pid_v3, instance.format_name, filename) | ||
|
||
|
||
class FileArticleFormatPubmedPmc(CommonControlField): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samuelveigarangel acho que é necessário uma única classe com o parâmetro com nome |
||
Article = ParentalKey( | ||
Article, | ||
null=True, | ||
blank=True, | ||
on_delete=models.SET_NULL, | ||
related_name="article_pubmed_pmc", | ||
) | ||
file = models.FileField( | ||
null=True, | ||
blank=True, | ||
verbose_name=_("File"), | ||
upload_to=article_directory_path_pubmed_pmc, | ||
) | ||
status = models.CharField( | ||
blank=True, | ||
null=True, | ||
max_length=5, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ | |
from django.db.models import Q, Count | ||
from django.contrib.auth import get_user_model | ||
from django.utils.translation import gettext as _ | ||
from packtools.sps.formats import pmc | ||
|
||
from article.models import Article, ArticleFormat | ||
|
||
from article.models import Article, ArticleFormat, Journal | ||
from article.sources import xmlsps | ||
from article.sources.preprint import harvest_preprints | ||
from config import celery_app | ||
|
@@ -295,3 +297,8 @@ def remove_duplicate_articles(pid_v3=None): | |
def remove_duplicate_articles_task(self, user_id=None, username=None, pid_v3=None): | ||
remove_duplicate_articles(pid_v3) | ||
|
||
@celery_app.task(bind=True) | ||
def create_files_articles_pubmed_pmc(self, user_id=None, username=None): | ||
pipeline = pmc.pipeline_pmc | ||
journals = Journal.objects.filter(Q(indexed_at__name="Pubmed") | Q(indexed_at__acronym="pmc")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samuelveigarangel pubmed e pmc são diferentes. Certamente, nem tudo o que é pmc é pubmed. Talvez nem tudo o que é pubmed é pmc. |
||
articles = Article.objects.filter(journal__in=journals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samuelveigarangel acho que bastaria um único InlinePanel