Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript fullCalendar,无法使用Django从事件源加载事件_Javascript_Django_Fullcalendar - Fatal编程技术网

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

Javascript fullCalendar,无法使用Django从事件源加载事件,javascript,django,fullcalendar,Javascript,Django,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', eve

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

这是我的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)


我做错了什么?

谢谢。更新了问题。您在那里显示的url是否与使用
url
模板标记构建的url相同?(我想知道它是否需要使用完整路径)是的。然而,url不是问题所在。它返回200和json对象。关于我的JSON对象,有一些东西是
addEventSource
不喜欢的。不幸的是,js控制台没有给我任何错误。如果我通过
$.ajax
(相同的url)检索JSON对象并逐个循环事件并执行
renderEvent
,将显示事件。这没有任何意义。你尝试过不同的日期格式吗?片段中唯一不同的地方是第一次使用YMD,而第二次使用的是timeYes。我也尝试过像“2016-01-01”这样的简单日期。我也尝试过这种格式:“2016-01-01T11:30:00”,但仍然没有显示任何事件。
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)