We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Scheduler: Cannot drag and drop items
I tried out event: https://open-event.herokuapp.com/events/59/scheduler/


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `open_event/api/sessions.py`
Content:
```
1 from flask.ext.restplus import Resource, Namespace
2 from sqlalchemy.orm.collections import InstrumentedList
3 
4 from open_event.models.session import Session as SessionModel
5 from open_event.models.track import Track as TrackModel
6 from open_event.models.microlocation import Microlocation as MicrolocationModel
7 from open_event.models.speaker import Speaker as SpeakerModel
8 
9 from .helpers.helpers import get_paginated_list, requires_auth, \
10     save_db_model, get_object_in_event
11 from .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
12     PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES
13 from .helpers import custom_fields as fields
14 from .helpers.special_fields import SessionLanguageField, SessionStateField
15 
16 api = Namespace('sessions', description='Sessions', path='/')
17 
18 # Create models
19 SESSION_TRACK = api.model('SessionTrack', {
20     'id': fields.Integer(required=True),
21     'name': fields.String(),
22 })
23 
24 SESSION_SPEAKER = api.model('SessionSpeaker', {
25     'id': fields.Integer(required=True),
26     'name': fields.String(),
27     'organisation': fields.String()
28 })
29 
30 SESSION_MICROLOCATION = api.model('SessionMicrolocation', {
31     'id': fields.Integer(required=True),
32     'name': fields.String(),
33 })
34 
35 SESSION = api.model('Session', {
36     'id': fields.Integer(required=True),
37     'title': fields.String(required=True),
38     'subtitle': fields.String(),
39     'short_abstract': fields.String(),
40     'long_abstract': fields.String(required=True),
41     'comments': fields.String(),
42     'start_time': fields.DateTime(required=True),
43     'end_time': fields.DateTime(required=True),
44     'track': fields.Nested(SESSION_TRACK, allow_null=True),
45     'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),
46     'language': SessionLanguageField(),
47     'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True),
48     'slides': fields.String(),
49     'video': fields.String(),
50     'audio': fields.String(),
51     'signup_url': fields.Uri(),
52     'state': SessionStateField()
53 })
54 
55 SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {
56     'results': fields.List(fields.Nested(SESSION))
57 })
58 
59 SESSION_POST = api.clone('SessionPost', SESSION, {
60     'track_id': fields.Integer(),
61     'speaker_ids': fields.List(fields.Integer()),
62     'microlocation_id': fields.Integer()
63 })
64 del SESSION_POST['id']
65 del SESSION_POST['track']
66 del SESSION_POST['speakers']
67 del SESSION_POST['microlocation']
68 
69 
70 # Create DAO
71 class SessionDAO(ServiceDAO):
72     def _delete_fields(self, data):
73         del data['speaker_ids']
74         del data['track_id']
75         del data['microlocation_id']
76         data['start_time'] = SESSION_POST['start_time'].from_str(
77             data['start_time'])
78         data['end_time'] = SESSION_POST['end_time'].from_str(data['end_time'])
79         return data
80 
81     def get_object(self, model, sid, event_id):
82         """
83         returns object (model). Checks if object is in same event
84         """
85         if sid is None:
86             return None
87         return get_object_in_event(model, sid, event_id)
88 
89     def fix_payload_post(self, event_id, data):
90         """
91         Fixes payload of POST request
92         """
93         data['track'] = self.get_object(TrackModel, data['track_id'], event_id)
94         data['microlocation'] = self.get_object(MicrolocationModel, data['microlocation_id'], event_id)
95         data['event_id'] = event_id
96         data['speakers'] = InstrumentedList(
97             SpeakerModel.query.get(_) for _ in data['speaker_ids']
98             if self.get_object(SpeakerModel, _, event_id) is not None
99         )
100         data = self._delete_fields(data)
101         return data
102 
103     def update(self, event_id, service_id, data):
104         data = self.validate(data)
105         data_copy = data.copy()
106         data_copy = self.fix_payload_post(event_id, data_copy)
107         data = self._delete_fields(data)
108         obj = ServiceDAO.update(self, event_id, service_id, data)
109         obj.track = data_copy['track']
110         obj.microlocation = data_copy['microlocation']
111         obj.speakers = data_copy['speakers']
112         obj = save_db_model(obj, SessionModel.__name__, event_id)
113         return obj
114 
115     def create(self, event_id, data, url):
116         data = self.validate(data)
117         payload = self.fix_payload_post(event_id, data)
118         return ServiceDAO.create(self, event_id, payload, url, validate=False)
119 
120 
121 DAO = SessionDAO(SessionModel, SESSION_POST)
122 
123 
124 @api.route('/events/<int:event_id>/sessions/<int:session_id>')
125 @api.response(404, 'Session not found')
126 @api.response(400, 'Session does not belong to event')
127 class Session(Resource):
128     @api.doc('get_session')
129     @api.marshal_with(SESSION)
130     def get(self, event_id, session_id):
131         """Fetch a session given its id"""
132         return DAO.get(event_id, session_id)
133 
134     @requires_auth
135     @api.doc('delete_session')
136     @api.marshal_with(SESSION)
137     def delete(self, event_id, session_id):
138         """Delete a session given its id"""
139         return DAO.delete(event_id, session_id)
140 
141     @requires_auth
142     @api.doc('update_session', responses=PUT_RESPONSES)
143     @api.marshal_with(SESSION)
144     @api.expect(SESSION_POST)
145     def put(self, event_id, session_id):
146         """Update a session given its id"""
147         return DAO.update(event_id, session_id, self.api.payload)
148 
149 
150 @api.route('/events/<int:event_id>/sessions')
151 class SessionList(Resource):
152     @api.doc('list_sessions')
153     @api.marshal_list_with(SESSION)
154     def get(self, event_id):
155         """List all sessions"""
156         return DAO.list(event_id)
157 
158     @requires_auth
159     @api.doc('create_session', responses=POST_RESPONSES)
160     @api.marshal_with(SESSION)
161     @api.expect(SESSION_POST)
162     def post(self, event_id):
163         """Create a session"""
164         return DAO.create(
165             event_id,
166             self.api.payload,
167             self.api.url_for(self, event_id=event_id)
168         )
169 
170 
171 @api.route('/events/<int:event_id>/sessions/page')
172 class SessionListPaginated(Resource, PaginatedResourceBase):
173     @api.doc('list_sessions_paginated', params=PAGE_PARAMS)
174     @api.marshal_with(SESSION_PAGINATED)
175     def get(self, event_id):
176         """List sessions in a paginated manner"""
177         return get_paginated_list(
178             SessionModel,
179             self.api.url_for(self, event_id=event_id),
180             args=self.parser.parse_args(),
181             event_id=event_id
182         )
183
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/open_event/api/sessions.py b/open_event/api/sessions.py
--- a/open_event/api/sessions.py
+++ b/open_event/api/sessions.py
@@ -37,10 +37,10 @@
     'title': fields.String(required=True),
     'subtitle': fields.String(),
     'short_abstract': fields.String(),
-    'long_abstract': fields.String(required=True),
+    'long_abstract': fields.String(),
     'comments': fields.String(),
-    'start_time': fields.DateTime(required=True),
-    'end_time': fields.DateTime(required=True),
+    'start_time': fields.DateTime(),
+    'end_time': fields.DateTime(),
     'track': fields.Nested(SESSION_TRACK, allow_null=True),
     'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),
     'language': SessionLanguageField(),

{"golden_diff": "diff --git a/open_event/api/sessions.py b/open_event/api/sessions.py\n--- a/open_event/api/sessions.py\n+++ b/open_event/api/sessions.py\n@@ -37,10 +37,10 @@\n     'title': fields.String(required=True),\n     'subtitle': fields.String(),\n     'short_abstract': fields.String(),\n-    'long_abstract': fields.String(required=True),\n+    'long_abstract': fields.String(),\n     'comments': fields.String(),\n-    'start_time': fields.DateTime(required=True),\n-    'end_time': fields.DateTime(required=True),\n+    'start_time': fields.DateTime(),\n+    'end_time': fields.DateTime(),\n     'track': fields.Nested(SESSION_TRACK, allow_null=True),\n     'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),\n     'language': SessionLanguageField(),\n", "issue": "Scheduler: Cannot drag and drop items\nI tried out event: https://open-event.herokuapp.com/events/59/scheduler/\n\n", "before_files": [{"content": "from flask.ext.restplus import Resource, Namespace\nfrom sqlalchemy.orm.collections import InstrumentedList\n\nfrom open_event.models.session import Session as SessionModel\nfrom open_event.models.track import Track as TrackModel\nfrom open_event.models.microlocation import Microlocation as MicrolocationModel\nfrom open_event.models.speaker import Speaker as SpeakerModel\n\nfrom .helpers.helpers import get_paginated_list, requires_auth, \\\n    save_db_model, get_object_in_event\nfrom .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \\\n    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES\nfrom .helpers import custom_fields as fields\nfrom .helpers.special_fields import SessionLanguageField, SessionStateField\n\napi = Namespace('sessions', description='Sessions', path='/')\n\n# Create models\nSESSION_TRACK = api.model('SessionTrack', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n})\n\nSESSION_SPEAKER = api.model('SessionSpeaker', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n    'organisation': fields.String()\n})\n\nSESSION_MICROLOCATION = api.model('SessionMicrolocation', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n})\n\nSESSION = api.model('Session', {\n    'id': fields.Integer(required=True),\n    'title': fields.String(required=True),\n    'subtitle': fields.String(),\n    'short_abstract': fields.String(),\n    'long_abstract': fields.String(required=True),\n    'comments': fields.String(),\n    'start_time': fields.DateTime(required=True),\n    'end_time': fields.DateTime(required=True),\n    'track': fields.Nested(SESSION_TRACK, allow_null=True),\n    'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),\n    'language': SessionLanguageField(),\n    'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True),\n    'slides': fields.String(),\n    'video': fields.String(),\n    'audio': fields.String(),\n    'signup_url': fields.Uri(),\n    'state': SessionStateField()\n})\n\nSESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {\n    'results': fields.List(fields.Nested(SESSION))\n})\n\nSESSION_POST = api.clone('SessionPost', SESSION, {\n    'track_id': fields.Integer(),\n    'speaker_ids': fields.List(fields.Integer()),\n    'microlocation_id': fields.Integer()\n})\ndel SESSION_POST['id']\ndel SESSION_POST['track']\ndel SESSION_POST['speakers']\ndel SESSION_POST['microlocation']\n\n\n# Create DAO\nclass SessionDAO(ServiceDAO):\n    def _delete_fields(self, data):\n        del data['speaker_ids']\n        del data['track_id']\n        del data['microlocation_id']\n        data['start_time'] = SESSION_POST['start_time'].from_str(\n            data['start_time'])\n        data['end_time'] = SESSION_POST['end_time'].from_str(data['end_time'])\n        return data\n\n    def get_object(self, model, sid, event_id):\n        \"\"\"\n        returns object (model). Checks if object is in same event\n        \"\"\"\n        if sid is None:\n            return None\n        return get_object_in_event(model, sid, event_id)\n\n    def fix_payload_post(self, event_id, data):\n        \"\"\"\n        Fixes payload of POST request\n        \"\"\"\n        data['track'] = self.get_object(TrackModel, data['track_id'], event_id)\n        data['microlocation'] = self.get_object(MicrolocationModel, data['microlocation_id'], event_id)\n        data['event_id'] = event_id\n        data['speakers'] = InstrumentedList(\n            SpeakerModel.query.get(_) for _ in data['speaker_ids']\n            if self.get_object(SpeakerModel, _, event_id) is not None\n        )\n        data = self._delete_fields(data)\n        return data\n\n    def update(self, event_id, service_id, data):\n        data = self.validate(data)\n        data_copy = data.copy()\n        data_copy = self.fix_payload_post(event_id, data_copy)\n        data = self._delete_fields(data)\n        obj = ServiceDAO.update(self, event_id, service_id, data)\n        obj.track = data_copy['track']\n        obj.microlocation = data_copy['microlocation']\n        obj.speakers = data_copy['speakers']\n        obj = save_db_model(obj, SessionModel.__name__, event_id)\n        return obj\n\n    def create(self, event_id, data, url):\n        data = self.validate(data)\n        payload = self.fix_payload_post(event_id, data)\n        return ServiceDAO.create(self, event_id, payload, url, validate=False)\n\n\nDAO = SessionDAO(SessionModel, SESSION_POST)\n\n\n@api.route('/events/<int:event_id>/sessions/<int:session_id>')\n@api.response(404, 'Session not found')\n@api.response(400, 'Session does not belong to event')\nclass Session(Resource):\n    @api.doc('get_session')\n    @api.marshal_with(SESSION)\n    def get(self, event_id, session_id):\n        \"\"\"Fetch a session given its id\"\"\"\n        return DAO.get(event_id, session_id)\n\n    @requires_auth\n    @api.doc('delete_session')\n    @api.marshal_with(SESSION)\n    def delete(self, event_id, session_id):\n        \"\"\"Delete a session given its id\"\"\"\n        return DAO.delete(event_id, session_id)\n\n    @requires_auth\n    @api.doc('update_session', responses=PUT_RESPONSES)\n    @api.marshal_with(SESSION)\n    @api.expect(SESSION_POST)\n    def put(self, event_id, session_id):\n        \"\"\"Update a session given its id\"\"\"\n        return DAO.update(event_id, session_id, self.api.payload)\n\n\n@api.route('/events/<int:event_id>/sessions')\nclass SessionList(Resource):\n    @api.doc('list_sessions')\n    @api.marshal_list_with(SESSION)\n    def get(self, event_id):\n        \"\"\"List all sessions\"\"\"\n        return DAO.list(event_id)\n\n    @requires_auth\n    @api.doc('create_session', responses=POST_RESPONSES)\n    @api.marshal_with(SESSION)\n    @api.expect(SESSION_POST)\n    def post(self, event_id):\n        \"\"\"Create a session\"\"\"\n        return DAO.create(\n            event_id,\n            self.api.payload,\n            self.api.url_for(self, event_id=event_id)\n        )\n\n\n@api.route('/events/<int:event_id>/sessions/page')\nclass SessionListPaginated(Resource, PaginatedResourceBase):\n    @api.doc('list_sessions_paginated', params=PAGE_PARAMS)\n    @api.marshal_with(SESSION_PAGINATED)\n    def get(self, event_id):\n        \"\"\"List sessions in a paginated manner\"\"\"\n        return get_paginated_list(\n            SessionModel,\n            self.api.url_for(self, event_id=event_id),\n            args=self.parser.parse_args(),\n            event_id=event_id\n        )\n", "path": "open_event/api/sessions.py"}], "after_files": [{"content": "from flask.ext.restplus import Resource, Namespace\nfrom sqlalchemy.orm.collections import InstrumentedList\n\nfrom open_event.models.session import Session as SessionModel\nfrom open_event.models.track import Track as TrackModel\nfrom open_event.models.microlocation import Microlocation as MicrolocationModel\nfrom open_event.models.speaker import Speaker as SpeakerModel\n\nfrom .helpers.helpers import get_paginated_list, requires_auth, \\\n    save_db_model, get_object_in_event\nfrom .helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \\\n    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES\nfrom .helpers import custom_fields as fields\nfrom .helpers.special_fields import SessionLanguageField, SessionStateField\n\napi = Namespace('sessions', description='Sessions', path='/')\n\n# Create models\nSESSION_TRACK = api.model('SessionTrack', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n})\n\nSESSION_SPEAKER = api.model('SessionSpeaker', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n    'organisation': fields.String()\n})\n\nSESSION_MICROLOCATION = api.model('SessionMicrolocation', {\n    'id': fields.Integer(required=True),\n    'name': fields.String(),\n})\n\nSESSION = api.model('Session', {\n    'id': fields.Integer(required=True),\n    'title': fields.String(required=True),\n    'subtitle': fields.String(),\n    'short_abstract': fields.String(),\n    'long_abstract': fields.String(),\n    'comments': fields.String(),\n    'start_time': fields.DateTime(),\n    'end_time': fields.DateTime(),\n    'track': fields.Nested(SESSION_TRACK, allow_null=True),\n    'speakers': fields.List(fields.Nested(SESSION_SPEAKER)),\n    'language': SessionLanguageField(),\n    'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True),\n    'slides': fields.String(),\n    'video': fields.String(),\n    'audio': fields.String(),\n    'signup_url': fields.Uri(),\n    'state': SessionStateField()\n})\n\nSESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {\n    'results': fields.List(fields.Nested(SESSION))\n})\n\nSESSION_POST = api.clone('SessionPost', SESSION, {\n    'track_id': fields.Integer(),\n    'speaker_ids': fields.List(fields.Integer()),\n    'microlocation_id': fields.Integer()\n})\ndel SESSION_POST['id']\ndel SESSION_POST['track']\ndel SESSION_POST['speakers']\ndel SESSION_POST['microlocation']\n\n\n# Create DAO\nclass SessionDAO(ServiceDAO):\n    def _delete_fields(self, data):\n        del data['speaker_ids']\n        del data['track_id']\n        del data['microlocation_id']\n        data['start_time'] = SESSION_POST['start_time'].from_str(\n            data['start_time'])\n        data['end_time'] = SESSION_POST['end_time'].from_str(data['end_time'])\n        return data\n\n    def get_object(self, model, sid, event_id):\n        \"\"\"\n        returns object (model). Checks if object is in same event\n        \"\"\"\n        if sid is None:\n            return None\n        return get_object_in_event(model, sid, event_id)\n\n    def fix_payload_post(self, event_id, data):\n        \"\"\"\n        Fixes payload of POST request\n        \"\"\"\n        data['track'] = self.get_object(TrackModel, data['track_id'], event_id)\n        data['microlocation'] = self.get_object(MicrolocationModel, data['microlocation_id'], event_id)\n        data['event_id'] = event_id\n        data['speakers'] = InstrumentedList(\n            SpeakerModel.query.get(_) for _ in data['speaker_ids']\n            if self.get_object(SpeakerModel, _, event_id) is not None\n        )\n        data = self._delete_fields(data)\n        return data\n\n    def update(self, event_id, service_id, data):\n        data = self.validate(data)\n        data_copy = data.copy()\n        data_copy = self.fix_payload_post(event_id, data_copy)\n        data = self._delete_fields(data)\n        obj = ServiceDAO.update(self, event_id, service_id, data)\n        obj.track = data_copy['track']\n        obj.microlocation = data_copy['microlocation']\n        obj.speakers = data_copy['speakers']\n        obj = save_db_model(obj, SessionModel.__name__, event_id)\n        return obj\n\n    def create(self, event_id, data, url):\n        data = self.validate(data)\n        payload = self.fix_payload_post(event_id, data)\n        return ServiceDAO.create(self, event_id, payload, url, validate=False)\n\n\nDAO = SessionDAO(SessionModel, SESSION_POST)\n\n\n@api.route('/events/<int:event_id>/sessions/<int:session_id>')\n@api.response(404, 'Session not found')\n@api.response(400, 'Session does not belong to event')\nclass Session(Resource):\n    @api.doc('get_session')\n    @api.marshal_with(SESSION)\n    def get(self, event_id, session_id):\n        \"\"\"Fetch a session given its id\"\"\"\n        return DAO.get(event_id, session_id)\n\n    @requires_auth\n    @api.doc('delete_session')\n    @api.marshal_with(SESSION)\n    def delete(self, event_id, session_id):\n        \"\"\"Delete a session given its id\"\"\"\n        return DAO.delete(event_id, session_id)\n\n    @requires_auth\n    @api.doc('update_session', responses=PUT_RESPONSES)\n    @api.marshal_with(SESSION)\n    @api.expect(SESSION_POST)\n    def put(self, event_id, session_id):\n        \"\"\"Update a session given its id\"\"\"\n        return DAO.update(event_id, session_id, self.api.payload)\n\n\n@api.route('/events/<int:event_id>/sessions')\nclass SessionList(Resource):\n    @api.doc('list_sessions')\n    @api.marshal_list_with(SESSION)\n    def get(self, event_id):\n        \"\"\"List all sessions\"\"\"\n        return DAO.list(event_id)\n\n    @requires_auth\n    @api.doc('create_session', responses=POST_RESPONSES)\n    @api.marshal_with(SESSION)\n    @api.expect(SESSION_POST)\n    def post(self, event_id):\n        \"\"\"Create a session\"\"\"\n        return DAO.create(\n            event_id,\n            self.api.payload,\n            self.api.url_for(self, event_id=event_id)\n        )\n\n\n@api.route('/events/<int:event_id>/sessions/page')\nclass SessionListPaginated(Resource, PaginatedResourceBase):\n    @api.doc('list_sessions_paginated', params=PAGE_PARAMS)\n    @api.marshal_with(SESSION_PAGINATED)\n    def get(self, event_id):\n        \"\"\"List sessions in a paginated manner\"\"\"\n        return get_paginated_list(\n            SessionModel,\n            self.api.url_for(self, event_id=event_id),\n            args=self.parser.parse_args(),\n            event_id=event_id\n        )\n", "path": "open_event/api/sessions.py"}]}