'title': fields.String(required=True),
        'subtitle': fields.String(),
        'level': fields.String(),
        'short_abstract': fields.String(),
        'long_abstract': fields.String(),
        'comments': fields.String(),
        'start_time': fields.DateTime(required=True),
        'end_time': fields.DateTime(required=True),
        'track': fields.Nested(SESSION_TRACK, allow_null=True),
        'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),
        'language': SessionLanguageField(),
        'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True),
        'slides': fields.Upload(),
        'video': fields.Upload(),
        'audio': fields.Upload(),
        'signup_url': fields.Uri(),
        'state': SessionStateField(),
        'session_type': fields.Nested(SESSION_TYPE, allow_null=True)
    })

SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL,
                              {'results': fields.List(fields.Nested(SESSION))})

SESSION_POST = api.clone(
    'SessionPost', SESSION, {
        'track_id': fields.Integer(),
        'speaker_ids': fields.List(fields.Integer()),
        'microlocation_id': fields.Integer(),
        'session_type_id': fields.Integer()
    })
Esempio n. 2
0
SPEAKER = api.model(
    'Speaker',
    {
        'id': fields.Integer(required=True),
        'name': fields.String(required=True),
        'photo': fields.Upload(),
        'small': fields.Upload(),
        'thumbnail': fields.Upload(),
        'icon': fields.Upload(),
        'short_biography': fields.String(),
        'long_biography': fields.String(),
        'email': fields.Email(required=True),
        'mobile': fields.String(),
        'featured': fields.Boolean(),
        'website': fields.Uri(),
        'twitter':
        fields.String(),  # not sure for now whether uri or string field
        'facebook': fields.String(),
        'github': fields.String(),
        'linkedin': fields.String(),
        'organisation': fields.String(required=True),
        'position': fields.String(),
        'country': fields.String(required=True),
        'sessions': fields.List(fields.Nested(SPEAKER_SESSION)),
        'city': fields.String(),
        'heard_from': fields.String(),
        'speaking_experience': fields.String(),
        'sponsorship_required': fields.String(),
        'gender': fields.String()
    })
from app.models.sponsor import Sponsor as SponsorModel
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (can_create, can_update, can_delete,
                                     requires_auth)
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('sponsors', description='Sponsors', path='/')

SPONSOR = api.model(
    'Sponsor', {
        'id': fields.Integer(required=True),
        'name': fields.String(required=True),
        'url': fields.Uri(),
        'logo': fields.Upload(),
        'description': fields.String(),
        'level': fields.String(),
        'sponsor_type': fields.String(),
    })

SPONSOR_PAGINATED = api.clone('SponsorPaginated', PAGINATED_MODEL,
                              {'results': fields.List(fields.Nested(SPONSOR))})

SPONSOR_POST = api.clone('SponsorPost', SPONSOR)
del SPONSOR_POST['id']


# Create DAO
class SponsorDAO(ServiceDAO):
from app.models.users_events_roles import UsersEventsRoles
from helpers.special_fields import EventTypeField, EventTopicField, \
    EventPrivacyField, EventSubTopicField, EventStateField
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import requires_auth, parse_args, \
    can_access, fake_marshal_with, fake_marshal_list_with, erase_from_dict, replace_event_id
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, BaseDAO, ServiceDAO
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('events', description='Events')

EVENT_COPYRIGHT = api.model(
    'EventCopyright', {
        'holder': fields.String(),
        'holder_url': fields.Uri(),
        'licence': fields.String(),
        'licence_url': fields.Uri(),
        'year': fields.Integer(),
        'logo': fields.String()
    })

EVENT_CFS = api.model(
    'EventCFS',
    {
        'announcement': fields.String(),
        'start_date': fields.DateTime(),
        'end_date': fields.DateTime(),
        'timezone': fields.String(),
        'privacy': EventPrivacyField()  # [public, private]
    })
from app.models.user import ORGANIZER
from app.models.users_events_roles import UsersEventsRoles
from helpers.special_fields import EventTypeField, EventTopicField, \
    EventPrivacyField, EventSubTopicField, EventStateField
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import requires_auth, parse_args, \
    can_access, fake_marshal_with, fake_marshal_list_with, erase_from_dict
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, BaseDAO, ServiceDAO
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('events', description='Events')

EVENT_COPYRIGHT = api.model('EventCopyright', {
    'holder': fields.String(),
    'holder_url': fields.Uri(),
    'licence': fields.String(),
    'licence_url': fields.Uri(),
    'year': fields.Integer(),
    'logo': fields.String()
})

EVENT_CFS = api.model('EventCFS', {
    'announcement': fields.String(),
    'start_date': fields.DateTime(),
    'end_date': fields.DateTime(),
    'timezone': fields.String(),
    'privacy': EventPrivacyField()  # [public, private]
})

EVENT_VERSION = api.model('EventVersion', {