from rest_framework.exceptions import ValidationError from rest_framework.response import Response from rest_framework.status import HTTP_404_NOT_FOUND, HTTP_200_OK, HTTP_400_BAD_REQUEST from entity.api import BaseEntityListView, BaseEntityDetailView, VersionedObjectMixin, BaseEntityView, BaseArchiveView from issuer.models import Issuer, BadgeClass, BadgeInstance from issuer.permissions import AwardedAssertionsBlock from issuer.serializers import IssuerSerializer, BadgeClassSerializer, BadgeInstanceSerializer from mainsite.exceptions import BadgrApiException400, BadgrValidationFieldError from mainsite.permissions import AuthenticatedWithVerifiedEmail from signing import tsob from signing.models import AssertionTimeStamp from signing.permissions import MaySignAssertions from staff.permissions import HasObjectPermission logger = badgrlog.BadgrLogger() class BadgeClassList(VersionedObjectMixin, BaseEntityListView): """ POST to create a new BadgeClass """ permission_classes = (AuthenticatedWithVerifiedEmail, ) # permissioned in serializer v1_serializer_class = BadgeClassSerializer http_method_names = ['post'] class IssuerList(VersionedObjectMixin, BaseEntityListView): """ POST to create a new Issuer
def get_logger(self): if self.logger: return self.logger self.logger = badgrlog.BadgrLogger() return self.logger