Getting fullcalendar javascript click data to django modelform

i want to click event on Fullcalendar, then it open another page, like this

<script>
    document.addEventListener('DOMContentLoaded', function() {
        var calendarEl = document.getElementById('calendar');
        var calendar = new FullCalendar.Calendar(calendarEl, {
            dateClick: function(info) {
                window.open("{% url 'create-book' %}","_self");
            },

.
but how to get data from fullcalendar ?
there are function dateStr for show date, and resource.id, to show resource in timeline view(fullcalendar)

 alert('clicked ' + info.dateStr + ' on resource ' + info.resource.id);           

.
what i want is bring dateStr and resource.id clicked data to django modelform,

here views.py

@login_required(login_url='login')
def create_book(request):
    booking_forms = BookingForm(initial={
        'resourceId':'xxxx',
        'startdate':'xxxx'
    })

im not sure what should i put on xxxx to get this through url on other page..

Thanks..

Leave a Comment