PyInventory/inventory/migrations/0007_add_file_attachment.py

129 wiersze
4.9 KiB
Python

# Generated by Django 2.2.20 on 2021-04-28 15:54
import uuid
import django.db.models.deletion
import django_tools.serve_media_app.models
import tagulous.models.fields
import tagulous.models.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('inventory', '0006_refactor_image_model'),
]
operations = [
migrations.CreateModel(
name='Tagulous_ItemFileModel_tags',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
('slug', models.SlugField()),
(
'count',
models.IntegerField(default=0, help_text='Internal counter of how many times this tag is in use'),
),
(
'protected',
models.BooleanField(default=False, help_text='Will not be deleted when the count reaches 0'),
),
],
options={
'ordering': ('name',),
'abstract': False,
'unique_together': {('slug',)},
},
bases=(tagulous.models.models.BaseTagModel, models.Model),
),
migrations.CreateModel(
name='ItemFileModel',
fields=[
(
'create_dt',
models.DateTimeField(
blank=True,
editable=False,
help_text='ModelTimetrackingMixin.create_dt.help_text',
null=True,
verbose_name='ModelTimetrackingMixin.create_dt.verbose_name',
),
),
(
'update_dt',
models.DateTimeField(
blank=True,
editable=False,
help_text='ModelTimetrackingMixin.update_dt.help_text',
null=True,
verbose_name='ModelTimetrackingMixin.update_dt.verbose_name',
),
),
(
'id',
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text='BaseModel.id.help_text',
primary_key=True,
serialize=False,
verbose_name='BaseModel.id.verbose_name',
),
),
(
'name',
models.CharField(
blank=True,
help_text='BaseItemAttachmentModel.name.help_text',
max_length=255,
null=True,
verbose_name='BaseItemAttachmentModel.name.verbose_name',
),
),
('position', models.PositiveSmallIntegerField(default=0)),
(
'file',
models.FileField(
help_text='ItemFileModel.file.help_text',
upload_to=django_tools.serve_media_app.models.user_directory_path,
verbose_name='ItemFileModel.file.verbose_name',
),
),
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.ItemModel')),
(
'tags',
tagulous.models.fields.TagField(
_set_tag_meta=True,
blank=True,
case_sensitive=False,
force_lowercase=False,
help_text='BaseModel.tags.help_text',
max_count=10,
space_delimiter=False,
to='inventory.Tagulous_ItemFileModel_tags',
verbose_name='BaseModel.tags.verbose_name',
),
),
(
'user',
models.ForeignKey(
editable=False,
help_text='BaseModel.user.help_text',
on_delete=django.db.models.deletion.CASCADE,
related_name='+',
to=settings.AUTH_USER_MODEL,
verbose_name='BaseModel.user.verbose_name',
),
),
],
options={
'verbose_name': 'ItemFileModel.verbose_name',
'verbose_name_plural': 'ItemFileModel.verbose_name_plural',
'ordering': ('position',),
},
),
]