dict code 非必填

This commit is contained in:
曹前明 2022-06-21 09:53:02 +08:00
parent 72637e749d
commit d9ba995bcc
4 changed files with 24 additions and 6 deletions

View File

@ -1,7 +1,7 @@
from django.shortcuts import render from django.shortcuts import render
from rest_framework.response import Response from rest_framework.response import Response
from apps.opm.models import GasCheck, Operation, Opl, OplCate, OplWorker from apps.opm.models import GasCheck, Operation, Opl, OplCate, OplWorker
from apps.opm.serializers import GasCheckCreateUpdateSerializer, GasCheckSerializer, OperationCreateUpdateSerializer, OperationSerializer, OplCateCreateUpdateSerializer, OplCateSerializer, OplSerializer, OplWorkerCreateSerializer, OplWorkerUpdateSerializer from apps.opm.serializers import GasCheckCreateUpdateSerializer, GasCheckSerializer, OperationCreateUpdateSerializer, OperationSerializer, OplCateCreateUpdateSerializer, OplCateSerializer, OplCreateUpdateSerializer, OplSerializer, OplWorkerCreateSerializer, OplWorkerUpdateSerializer
from apps.utils.viewsets import CustomGenericViewSet, CustomModelViewSet from apps.utils.viewsets import CustomGenericViewSet, CustomModelViewSet
from rest_framework.exceptions import ParseError from rest_framework.exceptions import ParseError
from rest_framework.mixins import CreateModelMixin, ListModelMixin, DestroyModelMixin from rest_framework.mixins import CreateModelMixin, ListModelMixin, DestroyModelMixin
@ -39,8 +39,8 @@ class OperationViewSet(CustomModelViewSet):
class OplViewSet(CustomModelViewSet): class OplViewSet(CustomModelViewSet):
queryset = Opl.objects.all() queryset = Opl.objects.all()
create_serializer_class = OplCateCreateUpdateSerializer create_serializer_class = OplCreateUpdateSerializer
update_serializer_class = OplCateCreateUpdateSerializer update_serializer_class = OplCreateUpdateSerializer
serializer_class = OplSerializer serializer_class = OplSerializer
def destroy(self, request, *args, **kwargs): def destroy(self, request, *args, **kwargs):

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.12 on 2022-06-21 01:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='dictionary',
name='value',
field=models.CharField(blank=True, max_length=10, null=True, verbose_name=''),
),
]

View File

@ -174,7 +174,7 @@ class Dictionary(CommonAModel):
数据字典 数据字典
""" """
name = models.CharField('名称', max_length=60) name = models.CharField('名称', max_length=60)
value = models.CharField('', max_length=10) value = models.CharField('', max_length=10, null=True, blank=True)
code = models.CharField('标识', max_length=30, null=True, blank=True) code = models.CharField('标识', max_length=30, null=True, blank=True)
description = models.TextField('描述', blank=True, null=True) description = models.TextField('描述', blank=True, null=True)
type = models.ForeignKey( type = models.ForeignKey(

View File

@ -320,7 +320,7 @@ class UserUpdateSerializer(CustomModelSerializer):
""" """
class Meta: class Meta:
model = User model = User
fields = ['username', 'name', 'avatar', 'is_active'] fields = ['username', 'name', 'avatar', 'is_active', 'phone']
def update(self, instance, validated_data): def update(self, instance, validated_data):
if User.objects.filter(username=validated_data['username'] if User.objects.filter(username=validated_data['username']
@ -337,7 +337,7 @@ class UserCreateSerializer(CustomModelSerializer):
class Meta: class Meta:
model = User model = User
fields = ['username', 'name', 'avatar', 'is_active'] fields = ['username', 'name', 'avatar', 'is_active', 'phone']
class PasswordChangeSerializer(serializers.Serializer): class PasswordChangeSerializer(serializers.Serializer):