Skip to main content

Add UTF-8 Validation to a Django FileField

Project description

Build status 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.

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-utf8field-0.0.1.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page