我试图通过将时间戳传递到Django CreateView的URL中来在FullCalendar中创建事件。但是,在我的表单上按Submit之后,我仍然得到空白页和错误消息:
Date,String
2010-12-31,'This, is, an example string'
2011-12-31,"This is an, example string"
2012-12-31,This is an example, string
html:
print(pd.read_csv('test.csv', sep='^([^,]+),', engine='python', usecols=['Date', 'String']))
urls.py
Date String
0 2010-12-31 'This, is, an example string'
1 2011-12-31 "This is an, example string"
2 2012-12-31 This is an example, string
Views.py:
Method Not Allowed (POST): /fullcalendar/ambroses-calendar/
Models.py:
dayClick: function(date, jsEvent, view) {
if($('#calendar').fullCalendar('getView').type != 'month') {
$("#occDiv").load("{% url 'edit_occurrence_short' 1234567898765 %}".replace(1234567898765, (new Date(date)).getTime())).dialog({
autoOpen: false,
modal: true,
bgiframe: true,
width: 800
});
$("#occDiv").dialog('open');
}
Forms.py:
url(r'^occurrence/add/(?P<date>\d+)/$',
ShortCreateOccurrenceView.as_view(),
name='edit_occurrence_short')
答案 0 :(得分:0)
问题下的评论使我找到了正确的答案。非常感谢@Willhen Van Onsem和@dirkgroten!
我可以通过在html中对表单进行操作来更改POST表单的来源
...
<form action="{% url 'edit_occurrence_short' date %}" method="post" >
...