当前位置: 首页>>代码示例>>Python>>正文


Python Namespace.model方法代码示例

本文整理汇总了Python中flask.ext.restplus.Namespace.model方法的典型用法代码示例。如果您正苦于以下问题:Python Namespace.model方法的具体用法?Python Namespace.model怎么用?Python Namespace.model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.ext.restplus.Namespace的用法示例。


在下文中一共展示了Namespace.model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: import

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.api.helpers.helpers import (
    can_create,
    can_update,
    can_delete,
    replace_event_id)
from app.api.helpers.helpers import model_custom_form, requires_auth
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from app.api.helpers.special_fields import SessionStateField
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('speakers', description='Speakers', path='/')

SPEAKER_SESSION = api.model('SpeakerSession', {
    'id': fields.Integer(),
    'title': fields.String(),
    'state': SessionStateField(),
})

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(),
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:33,代码来源:speakers.py

示例2: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
import os

from flask import send_file, make_response, jsonify, url_for, current_app
from flask.ext.restplus import Resource, Namespace, marshal

from app.helpers.data import record_activity
from helpers import custom_fields as fields
from helpers.export_helpers import export_event_json, create_export_job, send_export_mail
from helpers.helpers import nocache, can_access, requires_auth, replace_event_id
from helpers.utils import TASK_RESULTS

api = Namespace('exports', description='Exports', path='/')

EXPORT_SETTING = api.model('ExportSetting', {
    'image': fields.Boolean(default=False),
    'video': fields.Boolean(default=False),
    'document': fields.Boolean(default=False),
    'audio': fields.Boolean(default=False)
})


@nocache
@api.route('/events/<string:event_id>/export/json')
@api.hide
class EventExportJson(Resource):
    @requires_auth
    @replace_event_id
    @can_access
    @api.expect(EXPORT_SETTING)
    def post(self, event_id):
        from helpers.tasks import export_event_task
        # queue task
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:34,代码来源:exports.py

示例3: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from flask.ext.restplus import Resource, Namespace, fields

from open_event.models.session import Session as SessionModel
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('sessions', description='Sessions', path='/')

SESSION_TRACK = api.model('SessionTrack', {
    'id': fields.Integer(required=True),
    'name': fields.String,
})

SESSION_SPEAKER = api.model('SessionSpeaker', {
    'id': fields.Integer(required=True),
    'name': fields.String,
})

SESSION_LEVEL = api.model('SessionLevel', {
    'id': fields.Integer(required=True),
    'label_en': fields.String,
})

SESSION_LANGUAGE = api.model('SessionLanguage', {
    'id': fields.Integer(required=True),
    'label_en': fields.String,
    'label_de': fields.String,
})
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:32,代码来源:sessions.py

示例4: import

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from .helpers.helpers import (
    can_create,
    can_update,
    can_delete,
    requires_auth
)
from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from .helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('microlocations', description='Microlocations', path='/')

MICROLOCATION = api.model('Microlocation', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'latitude': fields.Float(),
    'longitude': fields.Float(),
    'floor': fields.Integer(),
    'room': fields.String(),
})

MICROLOCATION_PAGINATED = api.clone('MicrolocationPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(MICROLOCATION))
})

MICROLOCATION_POST = api.clone('MicrolocationPost', MICROLOCATION)
del MICROLOCATION_POST['id']


# Create DAO
class MicrolocationDAO(ServiceDAO):
    version_key = 'microlocations_ver'
开发者ID:aviaryan,项目名称:open-event-orga-server,代码行数:34,代码来源:microlocations.py

示例5: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from flask.ext.restplus import Resource, Namespace, fields

from open_event.models.session import Language as LanguageModel
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('languages', description='languages', path='/')

LANGUAGE = api.model('Language', {
    'id': fields.Integer(required=True),
    'name': fields.String,
    'label_en': fields.String,
    'label_de': fields.String,
})

LANGUAGE_PAGINATED = api.clone('LanguagePaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(LANGUAGE))
})


@api.route('/events/<int:event_id>/languages/<int:language_id>')
@api.response(404, 'Language not found')
@api.response(400, 'Object does not belong to event')
class Language(Resource):
    @api.doc('get_language')
    @api.marshal_with(LANGUAGE)
    def get(self, event_id, language_id):
        """Fetch a language given its id"""
        return get_object_in_event(LanguageModel, language_id, event_id)
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:33,代码来源:languages.py

示例6: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.helpers.data_getter import DataGetter
from app.models.users_events_roles import UsersEventsRoles

from .helpers.helpers import requires_auth, can_access_account, staff_only
from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, BaseDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES
from .helpers import custom_fields as fields

api = Namespace('users', description='Users', path='/')


USER_DETAIL = api.model('UserDetail', {
    'firstname': fields.String(),
    'lastname': fields.String(),
    'details': fields.String(),
    'avatar': fields.Upload(),
    'contact': fields.String(),
    'facebook': fields.String(),
    'twitter': fields.String()
})

USER = api.model('User', {
    'id': fields.Integer(),
    'email': fields.Email(required=True),
    'signup_time': fields.DateTime(),
    'last_access_time': fields.DateTime(),
    'user_detail': fields.Nested(USER_DETAIL)
})

USER_PAGINATED = api.clone('UserPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(USER))
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:33,代码来源:users.py

示例7: import

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.models.notifications import Notification as NotificationModel
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (
    can_create,
    requires_auth,
    replace_event_id)
from app.api.helpers.utils import PAGINATED_MODEL, ServiceDAO, \
    POST_RESPONSES
from app.api.helpers.utils import Resource

api = Namespace('notifications', description='Notifications', path='/')

NOTIFICATION = api.model('Notification', {
    'id': fields.Integer(required=True),
    'email': fields.String(required=True),
    'title': fields.String(),
    'message': fields.String(),
    'action': fields.String(),
    'received_at': fields.DateTime(),
})

NOTIFICATION_PAGINATED = api.clone('NotificationPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(NOTIFICATION))
})

NOTIFICATION_POST = api.clone('NotificationPost', NOTIFICATION)
del NOTIFICATION_POST['id']


# Create DAO
class NotificationDAO(ServiceDAO):
    version_key = 'notifications_ver'
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:34,代码来源:notifications.py

示例8: import

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.helpers.ticketing import TicketingManager

from app.api.helpers.helpers import (
    requires_auth,
    can_access)
from app.api.helpers.utils import POST_RESPONSES
from app.api.helpers.utils import Resource
from app.api.helpers import custom_fields as fields

api = Namespace('attendees', description='Attendees', path='/')

ATTENDEE = api.model('TicketHolder', {
    'id': fields.Integer(),
    'firstname': fields.String(),
    'lastname': fields.String(),
    'email': fields.Email(),
    'checked_in': fields.Boolean(),
    'order': fields.Nested(ORDER, allow_null=False),
    'ticket': fields.Nested(TICKET, allow_null=False)
})


@api.route('/events/<int:event_id>/attendees/')
class AttendeesList(Resource):
    @requires_auth
    @can_access
    @api.doc('check_in_toggle', responses=POST_RESPONSES)
    @api.marshal_list_with(ATTENDEE)
    def get(self, event_id):
        """Get attendees of the event"""
        return TicketingManager.get_attendees(event_id)
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:33,代码来源:attendees.py

示例9: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
    can_update,
    can_delete,
    replace_event_id)
from app.api.helpers.helpers import save_db_model, get_object_in_event, \
    model_custom_form, requires_auth, parse_args
from app.api.helpers.special_fields import SessionLanguageField, SessionStateField
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('sessions', description='Sessions', path='/')

# Create models
SESSION_TRACK = api.model('SessionTrack', {
    'id': fields.Integer(required=True),
    'name': fields.String(),
    'color': fields.Color(),
})

SESSION_SPEAKER = api.model('SessionSpeaker', {
    'id': fields.Integer(required=True),
    'name': fields.String(),
    'organisation': fields.String(),
    'city': fields.String(),
    'short_biography': fields.String(),
    'long_biography': fields.String(),
    'heard_from': fields.String(),
    'speaking_experience': fields.String(),
    'sponsorship_required': fields.String(),
    'short_biography': fields.String(),
    'long_biography' : fields.String(),
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:33,代码来源:sessions.py

示例10: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from flask.ext.restplus import Resource, Namespace, fields

from open_event.models.session import Level as LevelModel
from open_event.models.event import Event as EventModel
from .helpers import get_object_list, get_object_or_404, get_object_in_event,\
    get_paginated_list
from utils import PAGINATED_MODEL, PaginatedResourceBase

api = Namespace('levels', description='levels', path='/')

LEVEL = api.model('Level', {
    'id': fields.Integer(required=True),
    'name': fields.String,
    'label_en': fields.String,
})

LEVEL_PAGINATED = api.clone('LevelPaginated', PAGINATED_MODEL, {
    'results': fields.List(fields.Nested(LEVEL))
})


@api.route('/events/<int:event_id>/levels/<int:level_id>')
@api.response(404, 'Level not found')
@api.response(400, 'Object does not belong to event')
class Level(Resource):
    @api.doc('get_level')
    @api.marshal_with(LEVEL)
    def get(self, event_id, level_id):
        """Fetch a level given its id"""
        return get_object_in_event(LevelModel, level_id, event_id)
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:32,代码来源:levels.py

示例11: InvalidServiceCode

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
    __schema_example__ = 400


class InvalidServiceCode(Raw):
    __schema_type__ = 'integer'
    __schema_example__ = 400


class ServerCode(Raw):
    __schema_type__ = 'integer'
    __schema_example__ = 500


notfound_error_model = api.model('NotFoundError', {
    'code': NotFoundCode,
    'message': fields.String,
    'status': NotFoundStatus,
    'field': fields.String,
})

notauthorized_error_model = api.model('NotAuthorizedError', {
    'code': NotAuthorizedCode,
    'message': fields.String,
    'status': NotAuthorizedStatus,
    'field': fields.String,
})

permissiondenied_error_model = api.model('PermissionDeniedError', {
    'code': PermissionDeniedCode,
    'message': fields.String,
    'status': PermissionDeniedStatus,
    'field': fields.String,
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:34,代码来源:error_docs.py

示例12: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.models.user_detail import UserDetail as UserDetailModel
from app.helpers.data import DataManager, record_activity

from .helpers.helpers import requires_auth, can_access_account, staff_only
from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, BaseDAO, PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES
from .helpers import custom_fields as fields

api = Namespace("users", description="Users", path="/")


USER_DETAIL = api.model(
    "UserDetail",
    {
        "fullname": fields.String(),
        "details": fields.String(),
        "avatar": fields.Upload(),
        "contact": fields.String(),
        "facebook": fields.String(),
        "twitter": fields.String(),
    },
)

USER = api.model(
    "User",
    {
        "id": fields.Integer(),
        "email": fields.Email(required=True),
        "signup_time": fields.DateTime(),
        "last_access_time": fields.DateTime(),
        "user_detail": fields.Nested(USER_DETAIL),
    },
开发者ID:yasharmaster,项目名称:open-event-orga-server,代码行数:33,代码来源:users.py

示例13: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from app.models.user import ORGANIZER
from app.helpers.data import save_to_db, update_version, record_activity

from .helpers.helpers import requires_auth, parse_args, \
    can_access, fake_marshal_with, fake_marshal_list_with, erase_from_dict
from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, BaseDAO, ServiceDAO
from .helpers.utils import Resource
from .helpers import custom_fields as fields
from helpers.special_fields import EventTypeField, EventTopicField, \
    EventPrivacyField, EventSubTopicField

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

EVENT_CREATOR = api.model('EventCreator', {
    'id': fields.Integer(),
    'email': fields.Email()
})

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_VERSION = api.model('EventVersion', {
    'event_ver': fields.Integer(),
    'sessions_ver': fields.Integer(),
    'speakers_ver': fields.Integer(),
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:34,代码来源:events.py

示例14: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
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
from app.api.helpers.custom_fields import Licence

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', {
    'event_ver': fields.Integer(),
    'sessions_ver': fields.Integer(),
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:34,代码来源:events.py

示例15: Namespace

# 需要导入模块: from flask.ext.restplus import Namespace [as 别名]
# 或者: from flask.ext.restplus.Namespace import model [as 别名]
from open_event.models.users_events_roles import UsersEventsRoles
from open_event.models.role import Role
from open_event.models.user import ORGANIZER
from open_event.helpers.data import save_to_db, update_version

from .helpers.helpers import get_paginated_list, requires_auth, parse_args
from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, BaseDAO
from .helpers import custom_fields as fields
from helpers.special_fields import EventTypeField, EventTopicField


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

EVENT_CREATOR = api.model('EventCreator', {
    'id': fields.Integer(),
    'email': fields.Email()
})

EVENT = api.model('Event', {
    'id': fields.Integer(required=True),
    'name': fields.String(required=True),
    'email': fields.Email(),
    'color': fields.Color(),
    'logo': fields.ImageUri(),
    'start_time': fields.DateTime(required=True),
    'end_time': fields.DateTime(required=True),
    'latitude': fields.Float(),
    'longitude': fields.Float(),
    'event_url': fields.Uri(),
    'background_url': fields.ImageUri(),
    'description': fields.String(),
开发者ID:faheemzunjani,项目名称:open-event-orga-server,代码行数:34,代码来源:events.py


注:本文中的flask.ext.restplus.Namespace.model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。