django-monthfield
Introduction
This module provides a custom field for storing month (YYYY-MM) as a django field.
This can be useful when dealing with data that relates to a whole month, for example, the total expenditure for a given month.
This module also adds some arithmetic and other functionality for dealing with months.
Usage
Adding a month field to a django model:
from django.db import models
from month.models import MonthField
# Create your models here.
class ExampleModel(models.Model):
name = models.CharField(max_length=20, blank=True)
month = MonthField("Month Value", help_text="some help...")
def __unicode__(self):
return unicode(self.month)
The module defines a “Month” class which is used to represent the MonthField attribute on the model. The “Month” class can also be used standalone without any django model.
Some examples of funcionality provided by the Month class:
import month
m = month.Month(2017, 3)
print(m)
>"2017-03"
print(m + 2)
>"2017-05"
print(m.last_day())
>"2017-03-31"
m2 = month.Month(2017, 7)
print(m > m2)
>"False"
print(m.range(m2))
>"[2017-03, 2017-04, 2017-05, 2017-06, 2017-07]"
Example project
An example website using this module is included in the repository.
username: test password: test
Metadata
Release files for django-monthfield 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-monthfield-0.1.4.tar.gz | 7.2 kB | Without provenance | Details for django-monthfield-0.1.4.tar.gz |
Release files / django-monthfield-0.1.4.tar.gz
| Download URL | django-monthfield-0.1.4.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb7a40c19e10d20bc752d93f5a09b72f15ccaebd85fbb9f3f9b6d20052b5e9c9
|
|
BLAKE2b-256 checksum How to use checksums |
dea39a7ec0c37ea196161a1b002500050fc44d3b3b9cd5b53afc8d5845b47680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.8
|
Security for django-monthfield 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.