Use OneToOneField instead of a ForeignKey with unique=True.
This commit is contained in:
19
mayan/apps/checkouts/migrations/0005_auto_20160122_0756.py
Normal file
19
mayan/apps/checkouts/migrations/0005_auto_20160122_0756.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('checkouts', '0004_auto_20150617_0330'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='documentcheckout',
|
||||
name='document',
|
||||
field=models.OneToOneField(verbose_name='Document', to='documents.Document'),
|
||||
),
|
||||
]
|
||||
@@ -24,9 +24,7 @@ class DocumentCheckout(models.Model):
|
||||
"""
|
||||
Model to store the state and information of a document checkout
|
||||
"""
|
||||
document = models.ForeignKey(
|
||||
Document, unique=True, verbose_name=_('Document')
|
||||
)
|
||||
document = models.OneToOneField(Document, verbose_name=_('Document'))
|
||||
checkout_datetime = models.DateTimeField(
|
||||
auto_now_add=True, verbose_name=_('Check out date and time')
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user