mtm 表单设计必填去除

This commit is contained in:
caoqianming 2021-09-07 11:18:55 +08:00
parent 20a89f3d3f
commit bc84a62366
4 changed files with 40 additions and 10 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.6 on 2021-09-07 03:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0009_techdoc'),
]
operations = [
migrations.AlterField(
model_name='recordformfield',
name='boolean_field_display',
field=models.JSONField(blank=True, default=dict, help_text='当为布尔类型时候,可以支持自定义显示形式。{"1":"","0":""}或{"1":"需要","0":"不需要"},注意数字也需要引号', null=True, verbose_name='布尔类型显示名'),
),
migrations.AlterField(
model_name='recordformfield',
name='field_choice',
field=models.JSONField(blank=True, default=dict, help_text='radio,checkbox,select,multiselect类型可供选择的选项格式为json如:{"1":"中国", "2":"美国"},注意数字也需要引号', null=True, verbose_name='radio、checkbox、select的选项'),
),
]

View File

@ -109,9 +109,9 @@ class RecordFormField(CommonAModel):
field_type = models.CharField('类型', max_length=50, choices=field_type_choices) field_type = models.CharField('类型', max_length=50, choices=field_type_choices)
field_key = models.CharField('字段标识', max_length=50, help_text='字段类型请尽量特殊,避免与系统中关键字冲突') field_key = models.CharField('字段标识', max_length=50, help_text='字段类型请尽量特殊,避免与系统中关键字冲突')
field_name = models.CharField('字段名称', max_length=50) field_name = models.CharField('字段名称', max_length=50)
boolean_field_display = models.JSONField('布尔类型显示名', default=dict, blank=True, boolean_field_display = models.JSONField('布尔类型显示名', default=dict, blank=True, null=True,
help_text='当为布尔类型时候,可以支持自定义显示形式。{"1":"","0":""}或{"1":"需要","0":"不需要"},注意数字也需要引号') help_text='当为布尔类型时候,可以支持自定义显示形式。{"1":"","0":""}或{"1":"需要","0":"不需要"},注意数字也需要引号')
field_choice = models.JSONField('radio、checkbox、select的选项', default=dict, blank=True, field_choice = models.JSONField('radio、checkbox、select的选项', default=dict, blank=True, null=True,
help_text='radio,checkbox,select,multiselect类型可供选择的选项格式为json如:{"1":"中国", "2":"美国"},注意数字也需要引号') help_text='radio,checkbox,select,multiselect类型可供选择的选项格式为json如:{"1":"中国", "2":"美国"},注意数字也需要引号')
sort = models.IntegerField('排序号', default=1) sort = models.IntegerField('排序号', default=1)
class Meta: class Meta:

View File

@ -1,3 +1,5 @@
from numpy import product
from apps.system.models import CommonAModel
from django.db import models from django.db import models
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.db.models.base import Model from django.db.models.base import Model
@ -6,10 +8,11 @@ from django.db.models.query import QuerySet
from utils.model import SoftModel, BaseModel from utils.model import SoftModel, BaseModel
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
from apps.mtm.models import Material
class Customer(BaseModel): class Customer(CommonAModel):
""" """
客户信息 客户信息
""" """
@ -17,7 +20,7 @@ class Customer(BaseModel):
country = models.CharField('所属国家', max_length=20, blank=True, null=True) country = models.CharField('所属国家', max_length=20, blank=True, null=True)
address = models.CharField('详细地址', max_length=20, blank=True, null=True) address = models.CharField('详细地址', max_length=20, blank=True, null=True)
contact = models.CharField('联系人', max_length=20, blank=True, null=True) contact = models.CharField('联系人', max_length=20, blank=True, null=True)
contactphone = models.CharField('联系电话', max_length=11,unique=True, blank=True, null=True) phone = models.CharField('联系电话', max_length=11,unique=True, blank=True, null=True)
description = models.CharField('描述', max_length=200, blank=True, null=True) description = models.CharField('描述', max_length=200, blank=True, null=True)
class Meta: class Meta:
@ -27,16 +30,16 @@ class Customer(BaseModel):
def __str__(self): def __str__(self):
return self.name return self.name
class Contact(BaseModel): class Contact(CommonAModel):
""" """
合同信息 合同信息
""" """
name = models.CharField('合同名称', max_length=100) name = models.CharField('合同名称', max_length=100)
number = models.CharField('合同编号', max_length=100, unique=True, blank=True, null=True) number = models.CharField('合同编号', max_length=100, unique=True)
money = models.IntegerField('合同金额', default=0, null=True, blank=True) amount = models.IntegerField('合同金额', default=0)
customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer') customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer')
# contactuser = models.CharField('合同签订人', max_length=100, unique=True, blank=True, null=True) # contactuser = models.CharField('合同签订人', max_length=100, unique=True, blank=True, null=True)
date = models.DateField('签订日期', null=True, blank=True) sign_date = models.DateField('签订日期')
description = models.CharField('描述', max_length=200, blank=True, null=True) description = models.CharField('描述', max_length=200, blank=True, null=True)
class Meta: class Meta:
@ -46,11 +49,16 @@ class Contact(BaseModel):
def __str__(self): def __str__(self):
return self.name return self.name
class Order(BaseModel): class Order(CommonAModel):
""" """
订单信息 订单信息
""" """
number = models.CharField('订单编号', max_length=100) number = models.CharField('订单编号', max_length=100)
customer = models.ForeignKey(Customer, verbose_name='客户', on_delete=models.CASCADE)
contact = models.ForeignKey(Contact, verbose_name='所属合同', null=True, blank=True)
product = models.ForeignKey(Material, verbose_name='所需产品')
count = models.IntegerField('所需数量', default=0)
delivery_date = models.DateField('交货日期')
class Meta: class Meta:
verbose_name = '订单信息' verbose_name = '订单信息'
verbose_name_plural = verbose_name verbose_name_plural = verbose_name

View File

@ -10,4 +10,3 @@ drf-yasg==1.20.0
psutil==5.8.0 psutil==5.8.0
pillow==8.3.1 pillow==8.3.1
opencv-python==4.5.3.56 opencv-python==4.5.3.56
face-gecognition==1.3.0