django-measurement 2.0.0

Convenient fields and classes for handling measurements

Easily use, manipulate, and store unit-aware measurement objects using Python and Django.

Note: Version 2.0 has no backward compatibility due to major design changes.

django.contrib.gis.measure has these wonderful 'Distance' objects that can be used not only for storing a unit-aware distance measurement, but also for converting between different units and adding/subtracting these objects from one another.

This module provides for a django model field and admin interface for storing any measurements provided by python-measurement.

Example use with a model:

from django_measurement.models import MeasurementField
from django_measurement.measure import Volume
from django.db import models

class BeerConsumptionLogEntry(models.Model):
    name = models.CharField(max_length=255)
    volume = MeasurementField(Volume)

    def __unicode__(self):
        return u"%s of %s" % (self.name, self.volume)

entry = BeerConsumptionLogEntry()
entry.name = 'Bear Republic Racer 5'
entry.volume = Volume(us_pint=1)
entry.save()

These stored measurement objects can be used in all of the usual ways supported by python-measurement too:

>>> from django_measurement.measures import Weight
>>> weight_1 = Weight(lb=125)
>>> weight_2 = Weight(kg=40)
>>> added_together = weight_1 + weight_2
>>> added_together
Weight(lb=213.184976807)
>>> added_together.kg  # Maybe I actually need this value in kg?
96.699
  • Documentation for django-measurement is available an ReadTheDocs.
  • Please post issues on Github.
  • Test status available on Travis-CI.

Author

Adam Coddington

Pip

django-measurement==2.0.0

Classifiers

  • Development Status :: 5 - Production/Stable
  • Environment :: Web Environment
  • Framework :: Django
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 2.6
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 3.2
  • Programming Language :: Python :: 3.3
  • Programming Language :: Python :: 3.4
File Type Python Version Uploaded On Downloads
django-measurement-2.0.0.tar.gz Source June 9, 2015 4,715
Version Release Date
2.0.0 June 9, 2015
1.4 Feb. 18, 2014
1.3.3 Dec. 31, 2013
1.3.2 Dec. 31, 2013
1.3.1 Dec. 31, 2013
1.3 Dec. 30, 2013
1.2 Sept. 7, 2013
1.1 Sept. 7, 2013
1.0.2 July 27, 2013
1.0.1 July 22, 2013
1.0 July 21, 2013
0.9.2 March 27, 2013
0.9.1 Jan. 24, 2013
0.9 Jan. 23, 2013
0.8.1 Jan. 20, 2013
0.8 Jan. 20, 2013
0.7 Jan. 19, 2013
0.6 Jan. 19, 2013
0.5 Jan. 18, 2013
0.4 Jan. 18, 2013
0.3 Jan. 18, 2013
0.2 Jan. 18, 2013
0.1 Jan. 14, 2013
Date Package Version Action
Aug. 26, 2015, 12:16 a.m. django-measurement 1.3.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.3.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.3.3 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.8.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.9.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.9.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 2.0.0 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.0.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.0.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.9 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.6 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.7 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.4 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.5 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.3 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.3 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.0 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 0.8 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement 1.4 Release Created
Aug. 26, 2015, 12:16 a.m. django-measurement Package Created