testrecord serializer 增加draw_template字段
This commit is contained in:
parent
4257741c2d
commit
b373262d40
|
@ -3,7 +3,7 @@ from django.contrib.auth.models import AbstractUser
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
import django.utils.timezone as timezone
|
import django.utils.timezone as timezone
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File,Position
|
from apps.system.models import CommonADModel, CommonAModel, CommonBModel, Organization, User, Dict, File,Position
|
||||||
from utils.model import SoftModel, BaseModel
|
from utils.model import SoftModel, BaseModel
|
||||||
from simple_history.models import HistoricalRecords
|
from simple_history.models import HistoricalRecords
|
||||||
|
|
||||||
|
@ -36,3 +36,8 @@ class Employee(CommonAModel):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
class Attendance(CommonADModel):
|
||||||
|
"""
|
||||||
|
出勤记录
|
||||||
|
"""
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
from django.urls import reverse
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from rest_framework.test import APITestCase
|
||||||
|
from rest_framework import status
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
class WareHouseTests(APITestCase):
|
||||||
|
def test_list_warehouse(self):
|
||||||
|
url = reverse('warehouse-list')
|
||||||
|
resp = self.client.get(url)
|
||||||
|
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
|
@ -59,6 +59,7 @@ class TestRecordItemSerializer(serializers.ModelSerializer):
|
||||||
parent = serializers.PrimaryKeyRelatedField(source='form_field.parent', read_only=True)
|
parent = serializers.PrimaryKeyRelatedField(source='form_field.parent', read_only=True)
|
||||||
help_text = serializers.CharField(source='form_field.help_text', read_only=True)
|
help_text = serializers.CharField(source='form_field.help_text', read_only=True)
|
||||||
sort = serializers.IntegerField(source='form_field.sort', read_only=True)
|
sort = serializers.IntegerField(source='form_field.sort', read_only=True)
|
||||||
|
draw_template = serializers.CharField(source='form_field.draw_template', read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TestRecordItem
|
model = TestRecordItem
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -173,6 +173,7 @@ REST_FRAMEWORK = {
|
||||||
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
||||||
'UNAUTHENTICATED_USER': None,
|
'UNAUTHENTICATED_USER': None,
|
||||||
'UNAUTHENTICATED_TOKEN': None,
|
'UNAUTHENTICATED_TOKEN': None,
|
||||||
|
'TEST_REQUEST_DEFAULT_FORMAT': 'json'
|
||||||
}
|
}
|
||||||
# simplejwt配置
|
# simplejwt配置
|
||||||
SIMPLE_JWT = {
|
SIMPLE_JWT = {
|
||||||
|
|
Loading…
Reference in New Issue