material 增加牌号
This commit is contained in:
parent
e80d404de8
commit
a36b64362f
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.9 on 2022-06-06 05:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0051_material_file'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='material',
|
||||
name='brand',
|
||||
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='牌号'),
|
||||
),
|
||||
]
|
|
@ -36,6 +36,7 @@ class Material(CommonAModel):
|
|||
)
|
||||
name = models.CharField('物料名称', max_length=100)
|
||||
number = models.CharField('编号', max_length=100, unique=True)
|
||||
brand = models.CharField('牌号', max_length=100, null=True, blank=True)
|
||||
specification = models.CharField('型号', max_length=100, null=True, blank=True)
|
||||
type = models.PositiveSmallIntegerField('物料类型', choices= type_choices, default=1)
|
||||
sort_str = models.CharField('排序字符', max_length=100, null=True, blank=True)
|
||||
|
|
|
@ -46,7 +46,7 @@ class PackItemUpdateSerializer(serializers.ModelSerializer):
|
|||
class MaterialSimpleSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Material
|
||||
fields = ['id', 'name', 'number', 'unit','specification', 'type', 'count', 'count_safe']
|
||||
fields = ['id', 'name', 'number', 'unit','specification', 'type', 'count', 'count_safe', 'brand']
|
||||
|
||||
class PackItemDetailSerializer(serializers.ModelSerializer):
|
||||
material_ = MaterialSimpleSerializer(source='material', read_only=True)
|
||||
|
|
|
@ -184,7 +184,7 @@ class RecordFormViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet
|
|||
queryset = RecordForm.objects.all()
|
||||
filterset_fields = ['step', 'type', 'material', 'number', 'enabled']
|
||||
search_fields = ['name']
|
||||
ordering='id'
|
||||
ordering=['id']
|
||||
|
||||
|
||||
def get_serializer_class(self):
|
||||
|
@ -234,8 +234,8 @@ class RecordFormFieldViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelVi
|
|||
queryset = RecordFormField.objects.all()
|
||||
filterset_fields = ['field_type', 'form']
|
||||
search_fields = ['field_name', 'field_key']
|
||||
ordering = 'sort'
|
||||
ordering_fields = ['sort', 'id']
|
||||
ordering = ['sort', 'create_time']
|
||||
ordering_fields = ['sort', 'create_time']
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action =='create':
|
||||
|
|
Loading…
Reference in New Issue