Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voiio/django-citext
PostgreSQL CITEXT integration for Django
https://github.com/voiio/django-citext
case-insensitive citext database django postgresql
Last synced: 7 days ago
JSON representation
PostgreSQL CITEXT integration for Django
- Host: GitHub
- URL: https://github.com/voiio/django-citext
- Owner: voiio
- License: bsd-3-clause
- Created: 2023-09-05T09:09:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-18T13:56:12.000Z (8 months ago)
- Last Synced: 2024-03-18T15:19:46.381Z (8 months ago)
- Topics: case-insensitive, citext, database, django, postgresql
- Language: Python
- Homepage:
- Size: 48.8 KB
- Stars: 13
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Django CIText
PostgreSQL CIText integration for Django.
[![PyPi Version](https://img.shields.io/pypi/v/django-citext.svg)](https://pypi.python.org/pypi/django-citext/)
[![Test Coverage](https://codecov.io/gh/voiio/django-citext/branch/main/graph/badge.svg)](https://codecov.io/gh/voiio/django-citext)
[![GitHub License](https://img.shields.io/github/license/voiio/django-citext)](https://raw.githubusercontent.com/voiio/django-citext/main/LICENSE)## Setup
```ShellSession
python3 -m pip install django-citext
``````python
# settings.py
INSTALLED_APPS = [
'citext',
# ...
]
```## Usage
```python
# myapp/models.py
from django.db import models
from citext import CITextField, CIEmailFieldclass MyModel(models.Model):
name = CITextField()
email = CIEmailField(unique=True)
``````python
# myapp/views.py
from django.http import HttpResponse, HttpResponseNotFoundfrom . import models
def my_view(request, email):
try:
my_model = models.MyModel.objects.get(email=email)
except models.MyModel.DoesNotExist:
return HttpResponseNotFound()
return HttpResponse(my_model.name)
```## Credits
Project is based on the Django's own CIText implementation,
which was removed in Django 5.0. Big thanks to the Django contributors
for their excellent work.