Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
from django.shortcuts import render, redirect
from django.http import JsonResponse
from .models import Task
from datetime import date
import sweetify
def calendar_view(request):
"""Renders the calendar page."""
# Send reminders for tasks due today
tasks_due_today = Task.objects.filter(due_date=date.today(), assigned_to=request.user)
for task in tasks_due_today:
sweetify.info(request, f"Reminder: Task '{task.title}' is due today!", timer=5000)
return render(request, "calendar.html")
def calendar_data(request):
"""Returns tasks as JSON for FullCalendar."""
tasks = Task.objects.filter(assigned_to=request.user)
task_events = [
{
"title": task.title,
"start": task.due_date.strftime("%Y-%m-%d"),
"description": task.description,
}
for task in tasks
]
return JsonResponse(task_events, safe=False)
# urls.py
from django.urls import path
from . import views
urlpatterns = [
path("calendar/", views.calendar_view, name="calendar"),
path("calendar_data/", views.calendar_data, name="calendar_data"),
]
<!-- templates/calendar.html -->
{% extends 'base.html' %}
{% block content %}
<div class="container my-5">
<h2>Your Task Calendar</h2>
<div id="calendar"></div>
</div>
{% endblock %}
{% block extra_js %}
<script>
document.addEventListener("DOMContentLoaded", function () {
var calendarEl = document.getElementById("calendar");
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: "dayGridMonth",
headerToolbar: {
left: "prev,next today",
center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay",
},
events: "/calendar_data/",
eventClick: function(info) {
alert('Task: ' + info.event.title + 'nDescription: ' + info.event.extendedProps.description);
},
});
calendar.render();
});
</script>
{% endblock %}
/* static/css/calendar.css */
#calendar {
max-width: 900px;
margin: 0 auto;
background-color: #f8f9fa;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.container h2 {
color: #0c7477;
text-align: center;
margin-bottom: 20px;
}
<!-- base.html -->
<head>
<!-- FullCalendar CSS and JS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/main.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/main.min.js"></script>
</head>
<body>
{% block content %}{% endblock %}
{% block extra_js %}
{% sweetify %}
{% endblock %}
</body>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team