# Path: validators/ascii.py
# def validate_ascii_text(text):
#     "Check if text is a text with ASCII-only characters."
# 
#     if not is_ascii(text):
#         raise ValidationError(
#             'Please use only ASCII (Latin) letters.',
#             code='invalid',
#             params={'text': text},
#         )


import datetime
from hashlib import sha1
from django.utils import timezone
from django.db import models
from django.template.defaultfilters import slugify
from taggit.managers import TaggableManager
from geoposition.fields import GeopositionField
from django_countries.fields import CountryField
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.core.validators import MaxLengthValidator
from django.core.validators import MinValueValidator
from django.core.validators import MaxValueValidator
from validators.ascii import validate_ascii_text

    status = models.CharField(
        max_length=50,
        choices=STATUS_CHOICES,
        default='PENDING')
    title = models.CharField(max_length=255, default=None)
    slug = models.SlugField(max_length=255, null=True, blank=True)
    creator = models.ForeignKey(User)
    organizer = models.CharField(max_length=255, default=None)
    description = models.TextField(max_length=1000)
    geoposition = GeopositionField()
    location = models.CharField(max_length=1000)
    country = CountryField()
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()
    event_url = models.URLField(blank=True)
    contact_person = models.EmailField(blank=True)
    picture = models.ImageField(
        upload_to=settings.MEDIA_UPLOAD_FOLDER, blank=True)
    pub_date = models.DateTimeField(default=datetime.datetime.now())
    audience = models.ManyToManyField(
        EventAudience, related_name='event_audience')
    theme = models.ManyToManyField(EventTheme, related_name='event_theme')
    tags = TaggableManager(blank=True)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now_add=True)
    last_report_notification_sent_at = models.DateTimeField(null=True, blank=True)
    report_notifications_count = models.IntegerField(default=0, blank=True)
    name_for_certificate = models.CharField(
        max_length=255, default='', blank=True,

# Path: validators/ascii.py
# def validate_ascii_text(text):
#     "Check if text is a text with ASCII-only characters."
# 
#     if not is_ascii(text):
#         raise ValidationError(
#             'Please use only ASCII (Latin) letters.',
#             code='invalid',
#             params={'text': text},
#         )


# Path: api/models/events.py
import datetime
from hashlib import sha1
from django.utils import timezone
from django.db import models
from django.template.defaultfilters import slugify
from taggit.managers import TaggableManager
from geoposition.fields import GeopositionField
from django_countries.fields import CountryField
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.core.validators import MaxLengthValidator
from django.core.validators import MinValueValidator
from django.core.validators import MaxValueValidator
from validators.ascii import validate_ascii_text


    status = models.CharField(
        max_length=50,
        choices=STATUS_CHOICES,
        default='PENDING')
    title = models.CharField(max_length=255, default=None)
    slug = models.SlugField(max_length=255, null=True, blank=True)
    creator = models.ForeignKey(User)
    organizer = models.CharField(max_length=255, default=None)
    description = models.TextField(max_length=1000)
    geoposition = GeopositionField()
    location = models.CharField(max_length=1000)
    country = CountryField()
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()
    event_url = models.URLField(blank=True)
    contact_person = models.EmailField(blank=True)
    picture = models.ImageField(
        upload_to=settings.MEDIA_UPLOAD_FOLDER, blank=True)
    pub_date = models.DateTimeField(default=datetime.datetime.now())
    audience = models.ManyToManyField(
        EventAudience, related_name='event_audience')
    theme = models.ManyToManyField(EventTheme, related_name='event_theme')
    tags = TaggableManager(blank=True)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now_add=True)
    last_report_notification_sent_at = models.DateTimeField(null=True, blank=True)
    report_notifications_count = models.IntegerField(default=0, blank=True)
    name_for_certificate = models.CharField(
        max_length=255, default='', blank=True,

        validators=[MaxLengthValidator(70), validate_ascii_text]