Skip to content

Commit

Permalink
[Work] WorkAuthorship model
Browse files Browse the repository at this point in the history
  • Loading branch information
yattias committed May 17, 2024
1 parent c79411d commit 516e79e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
68 changes: 68 additions & 0 deletions src/paper/migrations/0124_workauthorship.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Generated by Django 4.1 on 2024-05-17 01:59

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("user", "0104_author_country_code_author_i10_index"),
("institution", "0004_institution_openalex_created_date_and_more"),
("paper", "0123_paper_is_retracted_paper_language_paper_mag_id_and_more"),
]

operations = [
migrations.CreateModel(
name="WorkAuthorship",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_date", models.DateTimeField(auto_now_add=True)),
("updated_date", models.DateTimeField(auto_now=True)),
(
"author_position",
models.CharField(
choices=[
("first", "First"),
("middle", "Middle"),
("last", "Last"),
],
max_length=10,
),
),
("is_corresponding", models.BooleanField(default=False)),
(
"raw_author_name",
models.CharField(blank=True, max_length=255, null=True),
),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="authorships",
to="user.author",
),
),
(
"institutions",
models.ManyToManyField(
blank=True,
null=True,
related_name="authors",
to="institution.institution",
),
),
],
options={
"abstract": False,
},
),
]
2 changes: 2 additions & 0 deletions src/paper/related_models/paper_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
from utils.aws import lambda_compress_and_linearize_pdf
from utils.http import check_url_contains_pdf, scraper_get_url

from .work_authorship_model import WorkAuthorship

DOI_IDENTIFIER = "10."
ARXIV_IDENTIFIER = "arXiv:"
HOT_SCORE_WEIGHT = 5
Expand Down
2 changes: 1 addition & 1 deletion src/paper/related_models/work_authorship_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WorkAuthorship(DefaultModel):
)

author = models.ForeignKey(
"Author",
"user.Author",
on_delete=models.CASCADE,
related_name="authorships",
)
Expand Down

0 comments on commit 516e79e

Please sign in to comment.