This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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

Installation

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://github.com/bitmazk/django-dated-values.git#egg=dated_values

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

Add dated_values to your INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'dated_values',
)

Add the dated_values URLs to your urls.py

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

Don’t forget to migrate your database

./manage.py migrate dated_values

Add css or write your own custom styles.

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

Usage

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.

Note

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': ctype.id, 'object_id': self.id})

Settings

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

Note

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
DATED_VALUES_DISPLAYED_ITEMS = 7

Contribute

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
Release History

Release History

0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-dated-values-0.2.tar.gz (16.4 kB) Copy SHA256 Checksum SHA256 Source Jan 16, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting