Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
🎨 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun committed Nov 15, 2024
1 parent 513469f commit c6db3a6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Generated by Django 5.2 on 2024-11-14 21:08
# Generated by Django 5.2 on 2024-11-15 12:53

import django.core.validators
import django.db.models.deletion
import lnschema_core.fields
import lnschema_core.ids
import lnschema_core.models
import lnschema_core.users
from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down Expand Up @@ -124,7 +125,17 @@ class Migration(migrations.Migration):
model_name="reference",
name="doi",
field=lnschema_core.fields.CharField(
blank=True, db_index=True, default=None, max_length=255, null=True
blank=True,
db_index=True,
default=None,
max_length=255,
null=True,
validators=[
django.core.validators.RegexValidator(
message="Must be a DOI (e.g., 10.1000/xyz123 or https://doi.org/10.1000/xyz123)",
regex="^(?:https?://(?:dx\\.)?doi\\.org/|doi:|DOI:)?10\\.\\d+/.*$",
)
],
),
),
migrations.AlterField(
Expand All @@ -137,9 +148,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="reference",
name="pubmed_id",
field=lnschema_core.fields.BigIntegerField(
blank=True, default=None, null=True
),
field=lnschema_core.fields.BigIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="reference",
Expand Down Expand Up @@ -173,4 +182,9 @@ class Migration(migrations.Migration):
name="updated_at",
field=lnschema_core.fields.DateTimeField(auto_now=True, db_index=True),
),
migrations.AlterField(
model_name="reference",
name="url",
field=models.URLField(blank=True, null=True),
),
]
14 changes: 12 additions & 2 deletions findrefs/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from django.core.validators import RegexValidator
from django.db import models
from django.db.models import CASCADE, PROTECT
from lnschema_core import ids
Expand Down Expand Up @@ -47,11 +48,20 @@ class Meta(Record.Meta, TracksRun.Meta, TracksUpdates.Meta):
null=True,
)
"""A unique abbreviation for the reference."""
url: str | None = models.URLField(null=True)
url: str | None = models.URLField(null=True, blank=True)
"""URL linking to the reference."""
pubmed_id: int | None = BigIntegerField(null=True)
"""A PudMmed ID."""
doi: int | None = CharField(null=True, db_index=True)
doi: int | None = CharField(
null=True,
db_index=True,
validators=[
RegexValidator(
regex=r"^(?:https?://(?:dx\.)?doi\.org/|doi:|DOI:)?10\.\d+/.*$",
message="Must be a DOI (e.g., 10.1000/xyz123 or https://doi.org/10.1000/xyz123)",
)
],
)
"""Digital Object Identifier (DOI) for the reference."""
text: str | None = TextField(null=True)
"""Text of the reference such as the abstract or the full-text to enable search."""
Expand Down

0 comments on commit c6db3a6

Please sign in to comment.