Example #1
0
from django.utils.translation import ugettext as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django.db.models.signals import post_save
# from dorsale.managers import DorsaleSiteManager
# from adhesive.models import DorsaleAnnotatedBaseModel
from dorsale.tools import class_from_name
from dateutil import rrule

import logging
logger = logging.getLogger(__name__)

from .settings import BASE_CLASS, MANAGER

BASE_CLASS = class_from_name(BASE_CLASS)
MANAGER = class_from_name(MANAGER)

logger.info(BASE_CLASS)
logger.info(MANAGER)

__all__ = (
    'EventType',
    'Event',
    'Occurrence',
    'create_event'
)


class EventType(models.Model):
    """
Example #2
0
from django import http
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.shortcuts import get_object_or_404, render
from django.utils import timezone

from dorsale.tools import class_from_name
from temporale.models import Event, Occurrence
from temporale import utils, forms
# from temporale.conf import settings as temporale_settings
from temporale.settings import (USE_ADHESIVE, FIRST_DAY_OF_WEEK, CALENDAR_FIRST_WEEKDAY)

if USE_ADHESIVE:
    note_model = class_from_name('adhesive.models.Note')
else:
    note_model = None

if FIRST_DAY_OF_WEEK is not None:
    if FIRST_DAY_OF_WEEK==0:
        calendar.setfirstweekday(6)
    else:
        calendar.setfirstweekday(FIRST_DAY_OF_WEEK-1)
elif CALENDAR_FIRST_WEEKDAY is not None:
    calendar.setfirstweekday(CALENDAR_FIRST_WEEKDAY)


@login_required
def event_listing(request, template='temporale/event_list.html', events=None,
    **extra_context):