From 251dcddafa55eb6370bc854de7c3d95ee39b3dc7 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sat, 20 Oct 2018 20:09:32 +0200 Subject: [PATCH] Add default to OrgPubFraction.fraction --- .../migrations/0046_auto_20181020_2008.py | 21 +++++++++++++++++++ journals/models.py | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 journals/migrations/0046_auto_20181020_2008.py diff --git a/journals/migrations/0046_auto_20181020_2008.py b/journals/migrations/0046_auto_20181020_2008.py new file mode 100644 index 000000000..932cc45a3 --- /dev/null +++ b/journals/migrations/0046_auto_20181020_2008.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-10-20 18:08 +from __future__ import unicode_literals + +from decimal import Decimal +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0045_auto_20180927_2055'), + ] + + operations = [ + migrations.AlterField( + model_name='orgpubfraction', + name='fraction', + field=models.DecimalField(decimal_places=3, default=Decimal('0.000'), max_digits=4), + ), + ] diff --git a/journals/models.py b/journals/models.py index c55706f3d..aac5e1c57 100644 --- a/journals/models.py +++ b/journals/models.py @@ -2,6 +2,8 @@ __copyright__ = "Copyright 2016-2018, Stichting SciPost (SciPost Foundation)" __license__ = "AGPL v3" +from decimal import Decimal + from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import JSONField @@ -648,7 +650,7 @@ class OrgPubFraction(models.Model): related_name='pubfractions', blank=True, null=True) publication = models.ForeignKey('journals.Publication', on_delete=models.CASCADE, related_name='pubfractions') - fraction = models.DecimalField(max_digits=4, decimal_places=3) + fraction = models.DecimalField(max_digits=4, decimal_places=3, default=Decimal('0.000')) class Meta: unique_together = (('organization', 'publication'),) -- GitLab