SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 3d0e79bc authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix unique journal vol/issue

parent c6681308
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-02-10 14:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('journals', '0006_publication_citedby'),
]
operations = [
migrations.AlterField(
model_name='issue',
name='number',
field=models.PositiveSmallIntegerField(),
),
migrations.AlterUniqueTogether(
name='issue',
unique_together=set([('number', 'in_volume')]),
),
]
...@@ -135,13 +135,16 @@ class Volume(models.Model): ...@@ -135,13 +135,16 @@ class Volume(models.Model):
class Issue(models.Model): class Issue(models.Model):
in_volume = models.ForeignKey(Volume, on_delete=models.CASCADE) in_volume = models.ForeignKey(Volume, on_delete=models.CASCADE)
number = models.PositiveSmallIntegerField(unique=True) number = models.PositiveSmallIntegerField()
start_date = models.DateField(default=timezone.now) start_date = models.DateField(default=timezone.now)
until_date = models.DateField(default=timezone.now) until_date = models.DateField(default=timezone.now)
doi_string = models.CharField(max_length=200, blank=True, null=True) doi_string = models.CharField(max_length=200, blank=True, null=True)
# absolute path on filesystem: (JOURNALS_DIR)/journal/vol/issue/ # absolute path on filesystem: (JOURNALS_DIR)/journal/vol/issue/
path = models.CharField(max_length=200) path = models.CharField(max_length=200)
class Meta:
unique_together = ('number', 'in_volume')
def __str__(self): def __str__(self):
text = str(self.in_volume) + ' issue ' + str(self.number) text = str(self.in_volume) + ' issue ' + str(self.number)
if self.start_date.month == self.until_date.month: if self.start_date.month == self.until_date.month:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment