You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

import logging
from rest_framework import mixins
from rest_framework import viewsets
from goods_info.models import AttachmentModel
from goods_info.serializer.attachment_serializer import AttachmentsSerializer
logger = logging.getLogger('my')
class AttachmentView(mixins.CreateModelMixin, mixins.DestroyModelMixin, viewsets.ReadOnlyModelViewSet):
"""
create: a_file必须是选择的一个文件 a_type:是一个字符串参考模型类代码
附件或者图片--新增
附件或者图片新增, status: 201(成功), return: 新增附件或者图片信息
destroy:
附件或者图片--删除
附件或者图片删除, status: 204(成功), return: None
list:
附件或者图片--获取分页列表
附件或者图片列表信息, status: 200(成功), return: 附件或者图片信息列表
retrieve:
查询某一个附件或者图片
查询指定ID的附件或者图片, status: 200(成功), return: 用户附件或者图片
"""
queryset = AttachmentModel.objects.all()
serializer_class = AttachmentsSerializer