Temporarily disable custom ModelField for IRI.

This commit is contained in:
RecursiveGreen 2019-06-03 14:41:23 -04:00
parent c48f848bba
commit eed7aee596
4 changed files with 28 additions and 5 deletions

View file

@ -18,6 +18,13 @@ class RadioIRIField(models.TextField):
https://code.djangoproject.com/ticket/25594
https://stackoverflow.com/questions/41756572/
'''
# TODO: Because of a shortcoming of Django's URLValidator code, the
# 'file://' scheme does not validate properly on most cases due to
# incompatibilities with optional hostnames. Disabling the custom field
# for now until I can figure out a non-lethal way of handling this.
# https://code.djangoproject.com/ticket/25595
default_validators = [validators.URLValidator(schemes=ALLOWED_SCHEMES)]
description = _("Long IRI")

View file

@ -18,4 +18,11 @@ class RadioIRIFormField(URLField):
https://code.djangoproject.com/ticket/25594
https://stackoverflow.com/questions/41756572/
'''
# TODO: Because of a shortcoming of Django's URLValidator code, the
# 'file://' scheme does not validate properly on most cases due to
# incompatibilities with optional hostnames. Disabling the custom field
# for now until I can figure out a non-lethal way of handling this.
# https://code.djangoproject.com/ticket/25595
default_validators = [validators.URLValidator(schemes=ALLOWED_SCHEMES)]

View file

@ -1,9 +1,8 @@
# Generated by Django 2.2.1 on 2019-05-31 03:00
# Generated by Django 2.2.1 on 2019-06-03 18:39
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import radio.fields
class Migration(migrations.Migration):
@ -19,7 +18,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField(auto_now_add=True, verbose_name='added on')),
('modified_date', models.DateTimeField(auto_now=True, verbose_name='last modified')),
('iri', radio.fields.RadioIRIField()),
('iri', models.TextField(verbose_name='IRI path to song file')),
('mime_type', models.CharField(blank=True, max_length=64, verbose_name='file MIME type')),
('file_size', models.BigIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='file size')),
('length', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True, verbose_name='song length (in seconds)')),

View file

@ -13,7 +13,7 @@ from django.utils.translation import ugettext_lazy as _
from core.behaviors import Disableable, Publishable, Timestampable
from core.utils import get_setting
from .fields import RadioIRIField
# from .fields import RadioIRIField
from .managers import RadioManager, SongManager
@ -104,7 +104,17 @@ class Store(Timestampable, models.Model):
'''
A model to represent various data locations (stores) for the song.
'''
iri = RadioIRIField()
# TODO: Because of a shortcoming of Django's URLValidator code, the
# 'file://' scheme does not validate properly on most cases due to
# incompatibilities with optional hostnames. Disabling the custom field
# for now until I can figure out a non-lethal way of handling this.
# https://code.djangoproject.com/ticket/25594
# https://code.djangoproject.com/ticket/25595
# https://stackoverflow.com/questions/41756572/
# iri = RadioIRIField()
iri = models.TextField(_('IRI path to song file'))
mime_type = models.CharField(_('file MIME type'),
max_length=64,
blank=True)