Skip to main content

Inclusive Django Range Fields which uses default bounds as '[]'

Project description

Inclusive Django Range Fields

Inclusive

The default bound of Django range fields is [). This package follows default bounds as [].

How to use?

Django

# models.py

from django.db import models
from inclusive_django_range_fields import InclusiveIntegerRangeField

class AdCampaign(models.Model):
    age_target = InclusiveIntegerRangeField()
>> AdCampaign.objects.first().age_target
NumericRange(18, 30, '[]')

Django Rest Framework

# serializers.py

from rest_framework import serializers
from inclusive_django_range_fields.drf import InclusiveIntegerRangeField

class AdCampaignSerializer(serializers.ModelSerializer):
    age_target = InclusiveIntegerRangeField()

    class Meta:
        model = AdCampaign
        fields = (
            "id",
            "age_target",
        )
{
  "id": 1993,
  "age_target": {
    "lower": 18,
    "upper": 30
  }
}

Reference

Model Fields

  • inclusive_django_range_fields.InclusiveIntegerRangeField
  • inclusive_django_range_fields.InclusiveBigIntegerRangeField
  • inclusive_django_range_fields.InclusiveDateRangeField

Ranges

  • inclusive_django_range_fields.InclusiveNumericRange
  • inclusive_django_range_fields.InclusiveDateRange
  • inclusive_django_range_fields.InclusiveDateTimeTZRange

Django Rest Framework Serializers

  • inclusive_django_range_fields.drf.InclusiveIntegerRangeField
  • inclusive_django_range_fields.drf.InclusiveDateRangeField

Form Fields

  • inclusive_django_range_fields.InclusiveIntegerRangeFormField
  • inclusive_django_range_fields.InclusiveDateRangeFormField

Project details


Download files

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

Source Distribution

inclusive_django_range_fields-0.2.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inclusive_django_range_fields-0.2.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file inclusive_django_range_fields-0.2.2.tar.gz.

File metadata

File hashes

Hashes for inclusive_django_range_fields-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0fb7169e221a54a2b108576983e91f8ff29a348cc73de7107b7b9e175b111246
MD5 cdb752d3ef53aff5e4691b6447dd77e7
BLAKE2b-256 b237245e415da93e1b347ec1dc2cab1295c300a51f1e0ce938bbc9014ff6ba62

See more details on using hashes here.

File details

Details for the file inclusive_django_range_fields-0.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for inclusive_django_range_fields-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8a068b027efcacf95d449fcb6e606fae2b5f00b5e9ded77a30e129bf6d8aedf8
MD5 c240de08b51a337cb7c7327af165ea29
BLAKE2b-256 08e5c1e2e66d97888b8d725c0817cc1112a23a9b147d4eba78af11e022aca977

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page