Renomear nome de campos class_ref para ref_class. Adicionar campos file e...

Renomear nome de campos class_ref para ref_class. Adicionar campos file e ref_track em Submission. Remover fields -> __all__ em User
parent 19d3b7a6
......@@ -9,6 +9,6 @@ class Certified(Document):
type = fields.StringField(max_length=255, required=True)
emission = fields.DateTimeField(required=True)
key = fields.StringField(max_length=255, required=True)
owner = fields.EmbeddedDocumentField(UserRef, required=True)
event_ref = fields.EmbeddedDocumentField(EventRef, required=True)
ref_user = fields.EmbeddedDocumentField(UserRef, required=True)
ref_event = fields.EmbeddedDocumentField(EventRef, required=True)
new_certified = fields.ReferenceField("self", required=False)
from mongoengine import Document, fields
from eventos.core.models import EventRef, UserRef
from eventos.core.models import EventRef, TrackRef, UserRef
class Submission(Document):
......@@ -9,5 +9,7 @@ class Submission(Document):
type = fields.StringField(max_length=255, required=True)
info = fields.StringField(max_length=255, required=True)
status = fields.BooleanField(default=False)
file = fields.FileField()
ref_track = fields.EmbeddedDocumentField(TrackRef, required=True)
owners = fields.EmbeddedDocumentListField(UserRef, required=True)
event_ref = fields.EmbeddedDocumentField(EventRef, required=True)
ref_event = fields.EmbeddedDocumentField(EventRef, required=True)
......@@ -5,8 +5,8 @@ from eventos.core.serializers import EventRefSerializer, UserRefSerializer
class CertifiedSerializer(serializers.DocumentSerializer):
event_ref = EventRefSerializer(many=False)
owner = UserRefSerializer(many=False)
ref_event = EventRefSerializer(many=False)
ref_user = UserRefSerializer(many=False)
class Meta:
ref_name = "Certified"
......
from rest_framework_mongoengine import serializers
from eventos.core.models import Submission, UserRef
from eventos.core.serializers import EventRefSerializer, UserRefSerializer
from eventos.core.serializers import EventRefSerializer, TrackRefSerializer, UserRefSerializer
class SubmissionSerializer(serializers.DocumentSerializer):
event_ref = EventRefSerializer(many=False)
ref_track = TrackRefSerializer(many=False)
ref_event = EventRefSerializer(many=False)
owners = UserRefSerializer(many=True)
class Meta:
......
......@@ -5,5 +5,5 @@ from eventos.core.models import User
class UserSerializer(serializers.DocumentSerializer):
class Meta:
ref_name = "User"
model = User
fields = "__all__"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment