Increase maximum filename size of FileFields

This commit is contained in:
Raphael Michel
2018-03-20 13:21:20 +01:00
parent 879eb6ee9f
commit 1f083a52eb
6 changed files with 72 additions and 6 deletions

View File

@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-20 12:19
from __future__ import unicode_literals
from django.db import migrations, models
import pretix.base.models.invoices
import pretix.base.models.orders
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0085_auto_20180312_1119'),
]
operations = [
migrations.AlterField(
model_name='cachedcombinedticket',
name='file',
field=models.FileField(blank=True, max_length=255, null=True, upload_to=pretix.base.models.orders.cachedcombinedticket_name),
),
migrations.AlterField(
model_name='cachedticket',
name='file',
field=models.FileField(blank=True, max_length=255, null=True, upload_to=pretix.base.models.orders.cachedticket_name),
),
migrations.AlterField(
model_name='invoice',
name='file',
field=models.FileField(blank=True, max_length=255, null=True, upload_to=pretix.base.models.invoices.invoice_filename),
),
migrations.AlterField(
model_name='question',
name='identifier',
field=models.CharField(help_text='You can enter any value here to make it easier to match the data with other sources. If you do not input one, we will generate one automatically.', max_length=190, verbose_name='Internal identifier'),
),
migrations.AlterField(
model_name='questionanswer',
name='file',
field=models.FileField(blank=True, max_length=255, null=True, upload_to=pretix.base.models.orders.answerfile_name),
),
]

View File

@@ -84,7 +84,7 @@ class Invoice(models.Model):
foreign_currency_rate = models.DecimalField(decimal_places=4, max_digits=10, null=True, blank=True)
foreign_currency_rate_date = models.DateField(null=True, blank=True)
file = models.FileField(null=True, blank=True, upload_to=invoice_filename)
file = models.FileField(null=True, blank=True, upload_to=invoice_filename, max_length=255)
internal_reference = models.TextField(blank=True)
@staticmethod

View File

@@ -471,7 +471,8 @@ class QuestionAnswer(models.Model):
)
answer = models.TextField()
file = models.FileField(
null=True, blank=True, upload_to=answerfile_name
null=True, blank=True, upload_to=answerfile_name,
max_length=255
)
@property
@@ -969,7 +970,7 @@ class CachedTicket(models.Model):
provider = models.CharField(max_length=255)
type = models.CharField(max_length=255)
extension = models.CharField(max_length=255)
file = models.FileField(null=True, blank=True, upload_to=cachedticket_name)
file = models.FileField(null=True, blank=True, upload_to=cachedticket_name, max_length=255)
created = models.DateTimeField(auto_now_add=True)
@@ -978,7 +979,7 @@ class CachedCombinedTicket(models.Model):
provider = models.CharField(max_length=255)
type = models.CharField(max_length=255)
extension = models.CharField(max_length=255)
file = models.FileField(null=True, blank=True, upload_to=cachedcombinedticket_name)
file = models.FileField(null=True, blank=True, upload_to=cachedcombinedticket_name, max_length=255)
created = models.DateTimeField(auto_now_add=True)

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-20 12:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pretixhelpers', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='thumbnail',
name='thumb',
field=models.FileField(max_length=255, upload_to='pub/thumbs/'),
),
]

View File

@@ -4,7 +4,7 @@ from django.db import models
class Thumbnail(models.Model):
source = models.CharField(max_length=255)
size = models.CharField(max_length=255)
thumb = models.FileField(upload_to='pub/thumbs/')
thumb = models.FileField(upload_to='pub/thumbs/', max_length=255)
class Meta:
unique_together = (('source', 'size'),)

View File

@@ -81,7 +81,9 @@ DATABASES = {
STATIC_URL = config.get('urls', 'static', fallback='/static/')
MEDIA_URL = config.get('urls', 'media', fallback='/media/')
MEDIA_URL = config.get('urls', 'media', fallback='https://cdn.pretix.space/')
NANOCDN_URL = "https://cdn:0R9uylkcSsm4PVksxnZyDfxLianeNH@cdn.pretix.space/"
DEFAULT_FILE_STORAGE = 'pretixeu.storage.NanoCDNStorage'
PRETIX_INSTANCE_NAME = config.get('pretix', 'instance_name', fallback='pretix.de')
PRETIX_REGISTRATION = config.getboolean('pretix', 'registration', fallback=True)