-
Notifications
You must be signed in to change notification settings - Fork 7
Criar funcionalidade de depósito de DOI no Crossref #872
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
Open
Copilot
wants to merge
3
commits into
main
Choose a base branch
from
copilot/create-crossref-doi-deposit-feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,3 +279,4 @@ core/media/ | |
| !.envs/.local/ | ||
| !.envs/.production/ | ||
| src/ | ||
| test.db | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,214 @@ | ||||||||||||||
| """ | ||||||||||||||
| Controller for Crossref DOI deposit operations. | ||||||||||||||
| """ | ||||||||||||||
|
|
||||||||||||||
| import logging | ||||||||||||||
| import sys | ||||||||||||||
|
|
||||||||||||||
| import requests | ||||||||||||||
| from lxml import etree | ||||||||||||||
| from packtools.sps.formats import crossref as crossref_format | ||||||||||||||
| from packtools.sps.pid_provider.xml_sps_lib import XMLWithPre | ||||||||||||||
|
|
||||||||||||||
| from tracker.models import UnexpectedEvent | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+9
to
+14
|
||||||||||||||
| from lxml import etree | |
| from packtools.sps.formats import crossref as crossref_format | |
| from packtools.sps.pid_provider.xml_sps_lib import XMLWithPre | |
| from tracker.models import UnexpectedEvent | |
| from packtools.sps.formats import crossref as crossref_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Generated by Django 5.2.3 on 2026-03-05 18:48 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('article', '0007_alter_article_options_article_first_pubdate_iso'), | ||
| ('doi', '0002_alter_doiwithlang_doi_alter_doiwithlang_lang'), | ||
| ('journal', '0014_alter_journal_title_alter_officialjournal_title'), | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='CrossrefConfiguration', | ||
| fields=[ | ||
| ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('created', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')), | ||
| ('updated', models.DateTimeField(auto_now=True, verbose_name='Last update date')), | ||
| ('crossmark_policy_url', models.URLField(blank=True, help_text="URL of the journal's crossmark policy page", null=True, verbose_name='Crossmark Policy URL')), | ||
| ('crossmark_policy_doi', models.CharField(blank=True, help_text="DOI of the journal's crossmark policy", max_length=256, null=True, verbose_name='Crossmark Policy DOI')), | ||
| ('depositor_name', models.CharField(help_text='Name of the depositor (contact person or organization)', max_length=256, verbose_name='Depositor Name')), | ||
| ('depositor_email', models.EmailField(help_text='Email address for deposit notifications', max_length=254, verbose_name='Depositor Email')), | ||
| ('registrant', models.CharField(help_text='Name of the organization registering the DOIs (typically the publisher)', max_length=256, verbose_name='Registrant')), | ||
| ('login_id', models.CharField(blank=True, help_text='Crossref member account username for API deposit', max_length=256, null=True, verbose_name='Crossref Login ID')), | ||
| ('login_password', models.CharField(blank=True, help_text='Crossref member account password for API deposit', max_length=256, null=True, verbose_name='Crossref Login Password')), | ||
| ('creator', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_creator', to=settings.AUTH_USER_MODEL, verbose_name='Creator')), | ||
| ('journal', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='crossref_configuration', to='journal.journal', verbose_name='Journal')), | ||
| ('updated_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_last_mod_user', to=settings.AUTH_USER_MODEL, verbose_name='Updater')), | ||
| ], | ||
| options={ | ||
| 'verbose_name': 'Crossref Configuration', | ||
| 'verbose_name_plural': 'Crossref Configurations', | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='CrossrefDeposit', | ||
| fields=[ | ||
| ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('created', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')), | ||
| ('updated', models.DateTimeField(auto_now=True, verbose_name='Last update date')), | ||
| ('status', models.CharField(choices=[('pending', 'Pending'), ('submitted', 'Submitted'), ('success', 'Success'), ('error', 'Error')], default='pending', max_length=16, verbose_name='Status')), | ||
| ('response_status', models.IntegerField(blank=True, null=True, verbose_name='HTTP Response Status')), | ||
| ('response_body', models.TextField(blank=True, null=True, verbose_name='Response Body')), | ||
| ('batch_id', models.CharField(blank=True, max_length=256, null=True, verbose_name='Batch ID')), | ||
| ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='crossref_deposits', to='article.article', verbose_name='Article')), | ||
| ('creator', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_creator', to=settings.AUTH_USER_MODEL, verbose_name='Creator')), | ||
| ('updated_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_last_mod_user', to=settings.AUTH_USER_MODEL, verbose_name='Updater')), | ||
| ('xml_crossref', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='deposits', to='doi.xmlcrossref', verbose_name='Crossref XML')), | ||
| ], | ||
| options={ | ||
| 'verbose_name': 'Crossref Deposit', | ||
| 'verbose_name_plural': 'Crossref Deposits', | ||
| 'ordering': ['-updated'], | ||
| }, | ||
| ), | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The new admin buttons trigger deposits via a plain GET link. Once the view is changed to require POST + CSRF (recommended), update this UI to use a
<form method="post">with{% csrf_token %}(and includeforceas a hidden field for re-deposit) so the action remains usable from the inspect page.