Metadata-Version: 2.1
Name: django-case-insensitive-field
Version: 1.0.3
Summary: Django Case Insensitive Field is used to make Django Model Field case insensitive - by default Django can't do this.
Home-page: https://github.com/iamoracle/django_case_insensitive_field
Author: iamoracle
Author-email: officialbilas@gmail.com
License: MIT
Download-URL: https://github.com/iamoracle/django_case_insensitive_field/archive/refs/tags/v1.0.3.tar.gz
Keywords: Django,Case Insensitive,Field,How to make Django Field,make django case insensitive
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
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: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Description-Content-Type: text/markdown

# Django Case Insensitive Field


```bash
# install from pypi
pip install django_case_insensitive_field
```

Django Case Insensitive Field is used to make Django Model Field case insensitive - by default Django can't do this. 

Let's assume you have a `username`  field on your `UserModel` which ofcourse would require `username` to be unique accross the `table` but to Django `abc` is different from `ABC` because it is case sensitive (meaning: users can use the same username but with different case).

Look at the example below:

```python
from django.db import models

class UserModel(models.Model):

    username = models.CharField(max_length=16, unique=True)



user1 = UserModel(username='user1') # will go through


user2 = UserModel(username='User1') # will still go through

```



## Using Django Case Insensitive Model

To make Django Model Field insensitive, you can use the code below:


```python

# fields.py

from django_case_insensitive_field import CaseInsensitiveField


class LowerCharField(CaseInsensitiveMixin, CharField):
    """[summary]
    Makes django CharField case insensitive \n
    Extends both the `CaseInsensitiveMixin` and  CharField \n
    Then you can import 
    """

    def __init__(self, *args, **kwargs):

        super(CaseInsensitiveMixin, self).__init__(*args, **kwargs) 


```

```python

# models.py

from .fields import LowerCharField


class UserModel(models.Model):

    username = LowerCharField(max_length=16, unique=True)

user1 = UserModel(username='user1') # will go through


user2 = UserModel(username='User1') # will not go through
```


## Dependencies

Holla! No dependecy. Lightweight!


