Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
786360f9
Commit
786360f9
authored
May 22, 2019
by
Luko van der Maas
Browse files
Merge branch 'fix/file-validators' into 'master'
Fix broken file validators See merge request
!1257
parents
3b795f16
befba3be
Changes
4
Hide whitespace changes
Inline
Side-by-side
website/documents/migrations/0012_auto_20190516_1536.py
0 → 100644
View file @
786360f9
# Generated by Django 2.2.1 on 2019-05-16 13:36
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'documents'
,
'0011_auto_20190327_1948'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'document'
,
name
=
'file_en'
,
field
=
models
.
FileField
(
upload_to
=
'documents/'
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
'txt'
,
'pdf'
,
'jpg'
,
'jpeg'
,
'png'
])],
verbose_name
=
'file (EN)'
),
),
migrations
.
AlterField
(
model_name
=
'document'
,
name
=
'file_nl'
,
field
=
models
.
FileField
(
upload_to
=
'documents/'
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
'txt'
,
'pdf'
,
'jpg'
,
'jpeg'
,
'png'
])],
verbose_name
=
'file (NL)'
),
),
]
website/documents/models.py
View file @
786360f9
...
...
@@ -49,7 +49,7 @@ class Document(models.Model, metaclass=ModelTranslateMeta):
verbose_name
=
_
(
'file'
),
upload_to
=
'documents/'
,
validators
=
[
FileExtensionValidator
(
[
'
.
txt'
,
'
.
pdf'
,
'
.
jpg'
,
'
.
jpeg'
,
'
.
png'
])],
[
'txt'
,
'pdf'
,
'jpg'
,
'jpeg'
,
'png'
])],
)
members_only
=
models
.
BooleanField
(
...
...
website/thabloid/migrations/0005_auto_20190516_1536.py
0 → 100644
View file @
786360f9
# Generated by Django 2.2.1 on 2019-05-16 13:36
import
django.core.validators
from
django.db
import
migrations
,
models
import
thabloid.models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'thabloid'
,
'0004_auto_20190327_1948'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'thabloid'
,
name
=
'file'
,
field
=
models
.
FileField
(
upload_to
=
thabloid
.
models
.
thabloid_filename
,
validators
=
[
django
.
core
.
validators
.
FileExtensionValidator
([
'txt'
,
'pdf'
,
'jpg'
,
'jpeg'
,
'png'
])]),
),
]
website/thabloid/models.py
View file @
786360f9
...
...
@@ -29,7 +29,7 @@ class Thabloid(models.Model):
file
=
models
.
FileField
(
upload_to
=
thabloid_filename
,
validators
=
[
FileExtensionValidator
(
[
'
.
txt'
,
'
.
pdf'
,
'
.
jpg'
,
'
.
jpeg'
,
'
.
png'
])],
[
'txt'
,
'pdf'
,
'jpg'
,
'jpeg'
,
'png'
])],
)
class
Meta
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment