Metadata-Version: 2.1
Name: inclusive-django-range-fields
Version: 0.2.3
Summary: Inclusive Django Range Fields which uses default bounds as '[]'
Home-page: https://github.com/hipo/inclusive-django-range-fields
License: Apache-2.0
Keywords: python,django,django rest framework,postgres,range field
Author: Hipo
Author-email: pypi@hipolabs.com
Requires-Python: >=2.7
Classifier: Framework :: Django
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: Django (>=1.8)
Requires-Dist: djangorestframework (>=3.0)
Project-URL: Repository, https://github.com/hipo/inclusive-django-range-fields
Description-Content-Type: text/markdown

# Inclusive Django Range Fields

![Inclusive](https://media.giphy.com/media/xUOwGdD7RGT4CTnUaY/giphy.gif "Inclusive")

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

## How to use?

```sh
pip install inclusive-django-range-fields
```

### Django

```python
# 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

```python
# 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",
        )
```

```json
{
  "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`


## PyPI
https://pypi.org/project/inclusive-django-range-fields/

