Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3231872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:05:44+00:00 2026-05-17T17:05:44+00:00

FullCalendar supports taking in a JSON object through AJAX for it’s events, this can

  • 0

FullCalendar supports taking in a JSON object through AJAX for it’s events, this can be done on initialization or later like this:

$('#calendar').fullCalendar('addEventSource', "/{{ user }}/events/" );

The serialization itself in my Django view looks like this:

...
events = Event.objects.filter(user=request.user, start__gte=start, end__lte=end)
message = serializers.serialize("json", events, ensure_ascii=False)
...

The JSON object that gets returned looks like this:

[{"pk": 2, "model": "main.event", "fields": {"url": null, "start": "2010-10-09 08:30:00", "end": "2010-10-09 10:30:00", "user": 1, "title": "sdf"}}, {"pk": 3, "model": "main.event", "fields": {"url": null, "start": "2010-10-03 08:30:00", "end": "2010-10-03 12:00:00", "user": 1, "title": "sdf2"}}]

The Fullcalendar event takes in the following variables: id, title, start, end, allDay and url.

I think FullCalendar is receiving my JSON object right now (not sure how to check) but it’s probably not acceptable, how can I make it acceptible for FullCalendar? It probably has too look something like this:

[{id: 1, title: 'Title1', start: new Date(2010, 10, 3, 8, 30), end: new Date(2010, 10, 3, 12, 0), allDay: false, url: false}]

or:

[{"id": 1, "title": 'Title1', "start": new Date(2010, 10, 3, 8, 30), "end": new Date(2010, 10, 3, 12, 0), "allDay": false, "url": false}]

Or even something else, not sure.

So basically the situation is that I haven’t worked with JSON objects before and I’m not sure how best to serialize the model into an acceptable JSON object, any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:05:45+00:00Added an answer on May 17, 2026 at 5:05 pm

    Don’t use Django’s built-in serializers for this. I almost never use them – they are very inflexible.

    Luckily, it’s very simple to serialize the content yourself.

    from django.utils import simplejson
    from django.core.serializers.json import DjangoJSONEncoder
    
    events = Event.objects.filter(
                  user=request.user, start__gte=start, end__lte=end
             ).values('id', 'title', 'start', 'end')
    data = simplejson.dumps(list(events), cls=DjangoJSONEncoder)
    

    Here I’m just getting a dictionary from the queryset via values, and passing it to simplejson to encode the select list of fields. I need to use the DjangoJSONEncoder as by default json doesn’t know about datetimes, so this encoder adds that functionality.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get Fullcalendar to cache events from a JSON feed? I don't
$('#calendar').fullCalendar ( { editable: true, events: $.ajax ( { type: POST, url: Calender.aspx/GetCDCatalog, contentType:
I am using FullCalendar to show some events. Basically I have a valid json
I'm using FullCalendar 1.5.3 to display events from a json feed. I have 4
I'm trying to use FullCalendar to display my events from a JSON feed. It's
When events are draggable in fullcalendar, I can drag them up past the start
I'm using fullcalendar , how can I fetch more events from same server side,
I'm using fullcalendar and It seems like longest events are always stacked first. Is
I have the fullcalendar working. But i have a sidebar users can collapse this
This is regarding jquery FullCalendar. I want to access an event object loaded into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.