fullCalendar,无法使用Django从事件源加载事件

时间:2016-01-13 09:12:48

标签: javascript django fullcalendar

我正在尝试从fullCalendar的事件源加载事件,但这似乎不起作用。事件根本不会显示在日历上。

这是我的js代码:

var event={
    title: 'AAA Birthday Party',
    start: moment().startOf('month').add(23, 'days').format('YYYY-MM-DD')
};
// This is shown on the calendar
$('#calendar').fullCalendar('renderEvent', event, true);

// This does not show
$('#calendar').fullCalendar('addEventSource', '/user/watch/calendar/events/0/');

这是我的views.py(它返回200 OK)

def watch_events(request, uid):
    test = {
        "events": [
            {
                "title": "Lesson1",
                "id": "821",
                "start": "2016-01-01 09:00:00",
                "end": "2016-01-01 10:30:00"
            },
            {
                "title": "Lesson2",
                "id": "822",
                "start": "2016-01-01 10:00:00",
                "end": "2016-01-01 11:30:00"
            }
        ],
        "color": 'yellow',
        "textColor": 'black'
    }
    return JsonResponse(test)

我做错了什么?

0 个答案:

没有答案