zoukankan      html  css  js  c++  java
  • django orm 多对多自定义第三张表

    # -*- coding: utf-8 -*-
    # Generated by Django 1.11.11 on 2018-09-02 08:07
    from __future__ import unicode_literals

    from django.conf import settings
    from django.db import migrations, models
    import django.db.models.deletion


    class Migration(migrations.Migration):

    dependencies = [
    ('fault_reporting', '0001_initial'),
    ]

    operations = [
    migrations.CreateModel(
    name='Comment',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('content', models.CharField(max_length=255)),
    ('create_time', models.DateTimeField(auto_now_add=True)),
    ],
    options={
    'verbose_name': '评论',
    'verbose_name_plural': '评论',
    },
    ),
    migrations.CreateModel(
    name='Fault2Tag',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ],
    options={
    'verbose_name': '故障-标签',
    'verbose_name_plural': '故障-标签',
    },
    ),
    migrations.CreateModel(
    name='FaultDetail',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('content', models.TextField()),
    ],
    options={
    'verbose_name': '故障详情表',
    'verbose_name_plural': '故障详情表',
    },
    ),
    migrations.CreateModel(
    name='FaultReport',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('title', models.CharField(max_length=80, verbose_name='故障标题')),
    ('desc', models.CharField(max_length=255, verbose_name='故障简介')),
    ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='发布时间')),
    ('modify_time', models.DateTimeField(auto_now=True, verbose_name='最后修改时间')),
    ],
    options={
    'verbose_name': '故障总结/故障报告',
    'verbose_name_plural': '故障总结/故障报告',
    },
    ),
    migrations.CreateModel(
    name='LOB',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('title', models.CharField(max_length=32, unique=True, verbose_name='业务线名称')),
    ],
    options={
    'verbose_name': '业务线',
    'verbose_name_plural': '业务线',
    },
    ),
    migrations.CreateModel(
    name='Tag',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('title', models.CharField(max_length=32, unique=True, verbose_name='标签名称')),
    ],
    options={
    'verbose_name': '标签',
    'verbose_name_plural': '标签',
    },
    ),
    migrations.CreateModel(
    name='UpDown',
    fields=[
    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
    ('is_up', models.BooleanField(default=True, verbose_name='支持/反对')),
    ('fault_report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.FaultReport', verbose_name='故障总结')),
    ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
    ],
    options={
    'verbose_name': '支持/反对',
    'verbose_name_plural': '支持/反对',
    },
    ),
    migrations.AddField(
    model_name='faultreport',
    name='lob',
    field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.LOB', verbose_name='所属业务线'),
    ),
    migrations.AddField(
    model_name='faultreport',
    name='tags',
    field=models.ManyToManyField(through='fault_reporting.Fault2Tag', to='fault_reporting.Tag'),
    ),
    migrations.AddField(
    model_name='faultreport',
    name='user',
    field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='发布者'),
    ),
    migrations.AddField(
    model_name='faultdetail',
    name='fault',
    field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.FaultReport'),
    ),
    migrations.AddField(
    model_name='fault2tag',
    name='fault_report',
    field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.FaultReport'),
    ),
    migrations.AddField(
    model_name='fault2tag',
    name='tag',
    field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.Tag'),
    ),
    migrations.AddField(
    model_name='comment',
    name='fault_report',
    field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.FaultReport', verbose_name='故障总结'),
    ),
    migrations.AddField(
    model_name='comment',
    name='parent_comment',
    field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='fault_reporting.Comment'),
    ),
    migrations.AddField(
    model_name='comment',
    name='user',
    field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
    ),
    migrations.AlterUniqueTogether(
    name='updown',
    unique_together=set([('fault_report', 'user')]),
    ),
    migrations.AlterUniqueTogether(
    name='fault2tag',
    unique_together=set([('fault_report', 'tag')]),
    ),
    ]

  • 相关阅读:
    iOS开发UI篇—IOS开发中Xcode的一些使用技巧
    iOS开发UI篇—推荐两个好用的Xcode插件(提供下载链接)
    iOS开发UI篇—UITableviewcell的性能问题
    iOS开发UI篇—UITableview控件基本使用
    iOS开发UI篇—UITableview控件简单介绍
    iOS开发UI篇—UIScrollView控件实现图片缩放功能
    iOS开发UI篇—实现UITableview控件数据刷新
    iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
    C# 高性能 TCP 服务的多种实现方式
    高性能数据传输系统的框架设计
  • 原文地址:https://www.cnblogs.com/liruixin/p/9728904.html
Copyright © 2011-2022 走看看