A reusable Django app that allows adding dated decimal values to any Django model

django, app, reusable, dates, management, values, generic
pip install django-dated-values==0.2


Django Dated Values

A reusable Django app that allows adding dated decimal values to any Django model.


To get the latest stable release from PyPi

pip install django-dated-values

To get the latest commit from GitHub

pip install -e git+git://

TODO: Describe further installation steps (edit / remove the examples below):

Add dated_values to your INSTALLED_APPS


Add the dated_values URLs to your

urlpatterns = patterns('',
    url(r'^dated-values/', include('dated_values.urls')),

Don't forget to migrate your database

./ migrate dated_values

Add css or write your own custom styles.

{% load static %}
<link href="{% static "dated_values/css/dated_values.css" %}" rel="stylesheet">


The usage is fairly straight forward. You need to add DatedValueType instances for every content type, that you want values to be added to.

The decimal_places field allows you to lower the amount of decimal places for form validation. It defaults to 2 and its max is 8.


Using postgres, it stores the full range of decimal places, no matter if you input less.

If you set hidden to True using the default template automatically hides the values in the form. You can e.g. use it to log values in the background without them being visible for users.

If you just set editable to True using the default template will render only the values and no input fields.

Once you've set that up and visit the management view, you will see a form table which holds all the values from all defined types for that item. The url kwargs require ctype_id and object_id. An example implementation might be:

class MyModel(models.Model):

...  # my fields and other things go here

def get_management_url(self):
    """Returns the management url from django-dated-values."""
    ctype = ContentType.objects.get_for_model(self.__class__)
    return reverse('dated_values_management_view', kwargs={
        'ctype_id':, 'object_id':})


The DATED_VALUES_ACCESS_ALLOWED setting expects a function, that takes the user and the content object as arguments. It is required to define the access permission for the values management view. Default is as follows:

DATED_VALUES_ACCESS_ALLOWED = lambda user, obj=None: user.is_staff


superusers will always be able to open the view, regardless of what is set here.

You can change the lenght of displayed items, defaulting to 14 (2 weeks) by setting DATED_VALUES_DISPLAYED_ITEMS:

# this will only show 1 week


If you want to contribute to this project, please perform the following steps

# Fork this repository
# Clone your fork
mkvirtualenv -p python2.7 django-dated-values
make develop

git co -b feature_branch master
# Implement your feature and tests
git add . && git commit
git push -u origin feature_branch
# Send us a pull request for your feature branch