Skip to content

Commit

Permalink
Django Appointment Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash0330 committed Mar 10, 2019
1 parent dfde05a commit 543a9e7
Show file tree
Hide file tree
Showing 164 changed files with 8,887 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.swp
*~
*.pyc
/project_sample/project_sample.db
/docs/_build/
django_schedule.egg-info
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
recursive-include docs *
recursive-include appointments/models/fixtures *.json
recursive-include project_sample *
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
# Django-Appointments
Django-schedule
===============

A calendaring/scheduling application, featuring:

* one-time and recurring events\
* calendar exceptions (occurrences changed or cancelled)\
* occurrences accessible through Event API and Period API\
* relations of events to generic objects\
* ready to use, nice user interface\
* view day, week, month, three months and year\
* project sample which can be launched immediately and reused in your
project



Installation
------------

Download the code; put in into your project’s directory or run

python setup.py install</pre> to install system-wide.

REQUIREMENTS: python-vobject (comes with most distribution as a package).

h2. Settings.py

h3. REQUIRED

INSTALLED_APPS - add:
'schedule'

TEMPLATE_CONTEXT_PROCESSORS - add:
"django.core.context_processors.request"

h4. Optional

FIRST_DAY_OF_WEEK

This setting determines which day of the week your calendar begins on if your locale doesn't already set it. Default is 0, which is Sunday.

OCCURRENCE_CANCEL_REDIRECT

This setting controls the behavior of :func:`Views.get_next_url`. If set, all calendar modifications will redirect here (unless there is a `next` set in the request.)

SHOW_CANCELLED_OCCURRENCES

This setting controls the behavior of :func:`Period.classify_occurence`. If True, then occurences that have been cancelled will be displayed with a css class of canceled, otherwise they won't appear at all.

Defaults to False

CHECK_PERMISSION_FUNC

This setting controls the callable used to determine if a user has permission to edit an event or occurance. The callable must take the object and the user and return a boolean.

Default:

check_edit_permission(ob, user):
return user.is_authenticated()

If ob is None, then the function is checking for permission to add new
events

GET\_EVENTS\_FUNC

This setting controls the callable that gets all events for calendar
display. The callable must take the request and the calendar and return
a `QuerySet` of events. Modifying this setting allows you to pull
events from multiple calendars or to filter events based on permissions
Empty file added appointments/__init__.py
Empty file.
68 changes: 68 additions & 0 deletions appointments/_feeds/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from appointments.models import Calendar
from django.contrib.syndication.feeds import FeedDoesNotExist
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from appointments.feeds.atom import Feed
from appointments.feeds.icalendar import ICalendarFeed
from django.http import HttpResponse
import datetime, itertools

class UpcomingEventsFeed(Feed):
feed_id = "upcoming"

def feed_title(self, obj):
return "Upcoming Events for %s" % obj.name

def get_object(self, bits):
if len(bits) != 1:
raise ObjectDoesNotExist
return Calendar.objects.get(pk=bits[0])

def link(self, obj):
if not obj:
raise FeedDoesNotExist
return obj.get_absolute_url()

def items(self, obj):
return itertools.islice(obj.occurrences_after(datetime.datetime.now()),
getattr(settings, "FEED_LIST_LENGTH", 10))

def item_id(self, item):
return str(item.id)

def item_title(self, item):
return item.event.title

def item_authors(self, item):
if item.event.creator is None:
return [{'name': ''}]
return [{"name": item.event.creator.username}]

def item_updated(self, item):
return item.event.created_on

def item_content(self, item):
return "%s \n %s" % (item.event.title, item.event.description)


class CalendarICalendar(ICalendarFeed):
def items(self):
cal_id = self.args[1]
cal = Calendar.objects.get(pk=cal_id)

return cal.events.all()

def item_uid(self, item):
return str(item.id)

def item_start(self, item):
return item.start

def item_end(self, item):
return item.end

def item_summary(self, item):
return item.title

def item_created(self, item):
return item.created_on
Loading

0 comments on commit 543a9e7

Please # to comment.