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

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.

Files for inclusive-django-range-fields, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size inclusive_django_range_fields-0.2.1-py2.py3-none-any.whl (5.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size inclusive_django_range_fields-0.2.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page