2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Add new global setting to control auto-upload of test reports (#3137)

* Add new global setting to control auto-upload of test reports

* Adds callback to attach a copy of the test report when printing

* Fix for all attachment API endpoints

- The AttachmentMixin must come first!
- User was not being set, as the custom 'perform_create' function was never called

* Remove duplicated UserSerializer

* display uploading user in attachment table

* Add unit test to check the test report is automatically uploaded
This commit is contained in:
Oliver
2022-06-06 15:20:41 +10:00
committed by GitHub
parent 2b1d8f5b79
commit a066fcc909
18 changed files with 116 additions and 80 deletions

View File

@ -10,8 +10,9 @@ from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from rest_framework.views import APIView
from InvenTree.serializers import UserSerializer
from users.models import Owner, RuleSet, check_user_role
from users.serializers import OwnerSerializer, UserSerializer
from users.serializers import OwnerSerializer
class OwnerList(generics.ListAPIView):

View File

@ -1,6 +1,5 @@
"""DRF API serializers for the 'users' app"""
from django.contrib.auth.models import User
from rest_framework import serializers
@ -9,19 +8,6 @@ from InvenTree.serializers import InvenTreeModelSerializer
from .models import Owner
class UserSerializer(InvenTreeModelSerializer):
"""Serializer for a User."""
class Meta:
"""Metaclass defines serializer fields."""
model = User
fields = ('pk',
'username',
'first_name',
'last_name',
'email',)
class OwnerSerializer(InvenTreeModelSerializer):
"""Serializer for an "Owner" (either a "user" or a "group")"""