Metadata-Version: 1.1
Name: django-utf8field
Version: 0.2.0
Summary: Add UTF-8 Validation to a Django FileField
Home-page: https://github.com/megasnort/django-utf8field
Author: Stef Bastiaansen
Author-email: stef@megasnort.com
License: Apache
Download-URL: https://github.com/megasnort/django-utf8field/archive/v0.2.0.tar.gz
Description-Content-Type: UNKNOWN
Description: ==================
        Django UTF-8 Field
        ==================
        
        .. image:: https://travis-ci.org/megasnort/django-utf8field.svg
            :target: https://travis-ci.org/megasnort/django-utf8field/
            :alt: Build status
        
        .. image:: https://coveralls.io/repos/github/megasnort/django-utf8field/badge.svg?branch=master
            :target: https://coveralls.io/github/megasnort/django-utf8field?branch=master
            :alt: Coverage
        
        Sometimes you want to only allow the uploading of UTF-8 text files. This library extends the Django FileField by checking if the content of a file is UTF-8. If not, it generates an error. An extra check is executed for four byte long characters, which too can cause problems when trying to process a file as UTF-8.
        
        Requirements
        ------------
        Django >= 1.8
        
        
        Installation
        ------------
        ::
        
            pip install django-utf8field
        
        
        Usage
        -----
        
        Add the app to your settings:
        
        ::
        
            INSTALLED_APPS = (
                ...
                'utf8field',
                ...
        
        
        Create a model like you would do normally, but instead of using FileField you use UTF8FileField:
        
        ::
        
            from django.db import models
            from utf8field.fields import UTF8FileField
        
            class YourModel(models.Model):
                title = models.CharField(max_length=255)
                created_on = models.DateTimeField(auto_add_on=True)
                text = models.UTF8FileField()
        
        
        
        
        
        You also have the option to provide the option `max_content_length` to limit the number of characters in the file. If the content is longer an error will be displayed.
        
        ::
        
            text = models.UTF8FileField(max_content_length=1000)
        
        
        
        
        Development
        -----------
        To run the tests make sure Django is installed (`pip install django`) and execute
        
        ::
        
            python manage.py test
        
        
        To create extra translations, execute
        
        ::
        
            pm makemessages --locale=nl --extension=py --ignore=dev_example
        
        
        ... and modify the resulting `django.po` file in `utf8field/locale/nl/LC_MESSAGES`.
Keywords: django utf-8
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Framework :: Django
