Skip to main content
Help us improve Python packaging – donate today!

A Django application to manage users Datebooks

Project Description

Introduction

Django datebook is.. a datebook !

This aims to manage user datebooks by months. A datebook contain day entries where you can add details, start and stop working hours, vacation, etc..

This does not aims to reproduce some advanced apps like Google calendar or alike, datebook is simple and will have a particular workflow for our needs at Emencia.

Requires

Optionnally

South usage has been dropped in favor of Django migrations;

Install

Install it from PyPi:

pip install django-datebook

Add it to your installed apps in settings :

INSTALLED_APPS = (
    ...
    'django_assets',
    'crispy_forms',
    'crispy_forms_foundation',
    'autobreadcrumbs',
    'datebook',
    ...
)

Append context processor in settings :

TEMPLATE_CONTEXT_PROCESSORS = (
    ...
    'autobreadcrumbs.context_processors.AutoBreadcrumbsContext',
    ...
)

Add required settings (into your project settings):

# Add 'foundation-5' layout pack
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'foundation-5')
# Default layout to use with "crispy_forms"
CRISPY_TEMPLATE_PACK = 'foundation-5'

from datebook.settings import *

(Also you can override some of its settings, see datebook.settings for more details).

Then in your urls.py :

from django.conf.urls import patterns, include, url
import autobreadcrumbs
autobreadcrumbs.autodiscover()

urlpatterns = patterns('',
    url(r'^datebook/', include('datebook.urls', namespace='datebook')),
)

Finally you will need to read Django-datebook templates to know about required template blocks and inheritance in your project templates.

Text markup

Default behavior configured in settings is to not use any Markup syntax usage.

But if you want you can configure some settings to use a Markup syntax renderer and a form field to use a specific editor.

This can be done with the following settings:

# Text markup renderer
DATEBOOK_TEXT_MARKUP_RENDER = None # Default, no renderer

# Field helper for texts in forms
DATEBOOK_TEXT_FIELD_HELPER_PATH = None # Default, just a CharField

# Template to init some Javascript for texts in forms
DATEBOOK_TEXT_FIELD_JS_TEMPLATE = None # Default, no JS template

# Validator helper for texts in forms
DATEBOOK_TEXT_VALIDATOR_HELPER_PATH = None # Default, no markup validation

They are the default values in the datebook settings.

Explanations

DATEBOOK_TEXT_FIELD_HELPER_PATH

a function that will be used to define a form field to use for text.

Signature is get_text_field(form_instance, **kwargs) where:

  • form_instance is the Form instance where it will be used from;
  • kwargs is a dict containing all default named arguments to give to the field. These default arguments are label for the field label name and required that is True (you should never change this);

This should return an instanciated form field that must act as a CharField.

DATEBOOK_TEXT_VALIDATOR_HELPER_PATH

A function that will be used to clean value on the form field text;

Signature is clean_restructuredtext(form_instance, content) where:

  • form_instance is the Form instance where it will be used from;
  • content is the value to validate;

Act like a Django form field cleaner method, this should return the cleaned value and eventually raise a validation error if needed.

DATEBOOK_TEXT_MARKUP_RENDER_TEMPLATE

A template to include to render text value with some markup syntax. It will have access to the page context with an additional value named content that will be the text to render;

DATEBOOK_TEXT_FIELD_JS_TEMPLATE

A template to include with forms when your custom form field require some Javascript to initialize it. It will have access to page context with an additional value named field that will be the targeted form field;

All these settings are only used with forms and template managing Datebook.notes and DayBase.content models attributes.

Example

There are the settings to use the shipped Markup syntax renderer and editor, disabled by default but that you can easily enable in your settings:

# Field helper for texts in forms
DATEBOOK_TEXT_FIELD_HELPER_PATH = "datebook.markup.get_text_field" # Use DjangoCodeMirror

# Validator helper for texts in forms
DATEBOOK_TEXT_VALIDATOR_HELPER_PATH = "datebook.markup.clean_restructuredtext" # Validation for RST syntax (with Rstview)

# Template to init some Javascript for texts in forms
DATEBOOK_TEXT_FIELD_JS_TEMPLATE = "datebook/markup/_text_field_djangocodemirror_js.html" # Use DjangoCodeMirror

# Text markup renderer
DATEBOOK_TEXT_MARKUP_RENDER_TEMPLATE = "datebook/markup/_text_markup_render.html" # Use Rstview renderer

Read their source code to see how they work in detail.

Warning

Before enabling these settings you must install rstview and Django-CodeMirror, see optional requirements to have the right versions to install.

Usage

Datebooks are monthly so each datebook object represents a unique month for a specific year. And datebook contains day entries where you can fill start and stop time, eventually the pause time and some optional text content to describe day activities.

For day entries, start and stop time represents times for starting and ending work, they will determine the worked time for the day.

Pause time represents the time that was not worked between start/stop time and so will be substracted from the total worked time.

Overtime represents the extra time that is over the working hours, it does not affect the worked time.

Day entries can be marked as vacation, vacated days will never be used to calculate the total worked time for the month and their content is hided if any.

Also, future days (days that are bigger or equal to the current day) are not used to calculate month totals (worked hours, overtime and vacations).

Permissions

At least to access to datebook views, users have to be logged in, there is no anonymous access.

Basic users can see all datebooks and can read their day entries, but they can’t add or edit datebooks that they don’t own and quite naturally they can’t add/edit day entries only on their own datebooks.

For admin management there is some available permissions :

  • ‘Can add datebook’ : used to create datebook for any user;
  • ‘Can change datebook’ : used to edit datebook for any user;
  • ‘Can add day entry’ : used to create day entries for any user’s datebook;
  • ‘Can change day entry’ : used to change day entries for any user’s datebook;

Permission level object (like with django-guardian) is not planned because the goal is not to share datebook between users. Only datebook owner should edit its entry and all datebook are visible for any logged users, because a team should be aware of everyone datebooks.

Day models

Often you would need to repeatedly fill your days with the approximately same content and so to avoid this there is Day models.

You can create a Day model from an existing day in your calendars, its content will be saved as a model and then you can use it to fill any another days in your calendar.

You can have multiple models, but they are allways for an unique user, models are not shareable through other users.

To fill days with a model, just go into a month calendar, open the models menu, select the day to fill, select the model to use and submit, existing days will be overwrited with model contents and empty selected days will be created with the model contents.

When filling days, default behavior does not use the model content text to fill the days, use the checkbox within the assignment form to use it.

Credits

Collaborators
For the “Sun umbrella” icon in webfont
Icon made by Freepik from www.flaticon.com is licensed under CC BY 3.0.
Other icons in webfont
Comes from various sets on IcoMoon.

Release history Release notifications

This version
History Node

1.2.0

History Node

1.1.1

History Node

1.1.0

History Node

1.0.0

History Node

0.9.5

History Node

0.9.4

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

History Node

0.9.0

History Node

0.8.8

History Node

0.8.7

History Node

0.8.6

History Node

0.8.5

History Node

0.8.4

History Node

0.8.3

History Node

0.8

History Node

0.7.1

History Node

0.7

History Node

0.6.2

History Node

0.6.1

History Node

0.6

History Node

0.5.1

History Node

0.5

History Node

0.4

History Node

0.3.5

History Node

0.3

History Node

0.2.6

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.1.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-datebook-1.2.0.tar.gz (109.7 kB) Copy SHA256 hash SHA256 Source None Nov 8, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page