Update Document model's uuid field to use Django's native UUIDField class.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
- Add new permission: checkout details view.
|
||||
- Add HTML5 upload widget. Issue #162.
|
||||
- Add Message of the Day app. Issue #222
|
||||
- Update Document model's uuid field to use Django's native UUIDField class.
|
||||
|
||||
2.0.2 (2016-02-09)
|
||||
==================
|
||||
|
||||
@@ -7,7 +7,7 @@ Released: April, 2016
|
||||
What's new
|
||||
==========
|
||||
|
||||
- Upgrade to use Django 1.8.8.
|
||||
- Upgrade to use Django 1.8.11.
|
||||
- Remove remaining references to Django's User model.
|
||||
- Remove included login required middleware using django-stronghold instead (http://mikegrouchy.com/django-stronghold/).
|
||||
- Improve generation of success and error messages for class based views.
|
||||
@@ -17,8 +17,8 @@ What's new
|
||||
- Implement per document type document creation permission.
|
||||
- Make document type delete time period optional.
|
||||
- Fixed date locale handling in document properties, checkout and user detail views.
|
||||
- Add HTML5 upload widget. Issue #162.
|
||||
- Add Message of the Day app. Issue #222
|
||||
- Add HTML5 upload widget.
|
||||
- Add Message of the Day app.
|
||||
|
||||
Other changes
|
||||
=============
|
||||
@@ -30,7 +30,7 @@ Other changes
|
||||
- Add new permission: checkout details view.
|
||||
- Add HTML tags stripping to the browser title generation template.
|
||||
- Folder and Tag creation API calls now return the id of the created instances.
|
||||
|
||||
- Update Document model's uuid field to use Django's native UUIDField class.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -14,8 +14,17 @@ class Migration(migrations.Migration):
|
||||
migrations.CreateModel(
|
||||
name='NewVersionBlock',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('document', models.ForeignKey(verbose_name='Document', to='documents.Document')),
|
||||
(
|
||||
'id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True
|
||||
)
|
||||
),
|
||||
(
|
||||
'document', models.ForeignKey(
|
||||
verbose_name='Document', to='documents.Document'
|
||||
)
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'New version block',
|
||||
|
||||
@@ -14,11 +14,21 @@ class Migration(migrations.Migration):
|
||||
migrations.AlterField(
|
||||
model_name='documenttype',
|
||||
name='delete_time_period',
|
||||
field=models.PositiveIntegerField(default=30, help_text='Amount of time after which documents of this type in the trash will be deleted.', null=True, verbose_name='Delete time period', blank=True),
|
||||
field=models.PositiveIntegerField(
|
||||
default=30, help_text='Amount of time after which documents '
|
||||
'of this type in the trash will be deleted.', null=True,
|
||||
verbose_name='Delete time period', blank=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='documenttype',
|
||||
name='delete_time_unit',
|
||||
field=models.CharField(default='days', choices=[('days', 'Days'), ('hours', 'Hours'), ('minutes', 'Minutes')], max_length=8, blank=True, null=True, verbose_name='Delete time unit'),
|
||||
field=models.CharField(
|
||||
default='days', choices=[
|
||||
('days', 'Days'), ('hours', 'Hours'),
|
||||
('minutes', 'Minutes')
|
||||
], max_length=8, blank=True, null=True,
|
||||
verbose_name='Delete time unit'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
25
mayan/apps/documents/migrations/0031_convert_uuid.py
Normal file
25
mayan/apps/documents/migrations/0031_convert_uuid.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import uuid
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def convert_uuid_to_hex(apps, schema_editor):
|
||||
Document = apps.get_model('documents', 'Document')
|
||||
|
||||
for document in Document.objects.all():
|
||||
document.uuid = uuid.UUID(document.uuid).hex
|
||||
document.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('documents', '0030_auto_20160309_1837'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(convert_uuid_to_hex),
|
||||
]
|
||||
20
mayan/apps/documents/migrations/0032_auto_20160315_0537.py
Normal file
20
mayan/apps/documents/migrations/0032_auto_20160315_0537.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('documents', '0031_convert_uuid'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='document',
|
||||
name='uuid',
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False),
|
||||
),
|
||||
]
|
||||
@@ -149,9 +149,7 @@ class Document(models.Model):
|
||||
Defines a single document with it's fields and properties
|
||||
"""
|
||||
|
||||
uuid = models.CharField(
|
||||
default=UUID_FUNCTION, editable=False, max_length=48
|
||||
)
|
||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||
document_type = models.ForeignKey(
|
||||
DocumentType, related_name='documents',
|
||||
verbose_name=_('Document type')
|
||||
|
||||
Reference in New Issue
Block a user