|
1 | 1 | import os
|
2 | 2 | import itertools
|
| 3 | +import gridfs |
3 | 4 |
|
4 | 5 | from django.utils.datastructures import SortedDict
|
5 | 6 |
|
6 | 7 | from django.forms.forms import BaseForm, get_declared_fields, NON_FIELD_ERRORS, pretty_name
|
7 | 8 | from django.forms.widgets import media_property
|
8 |
| -from django.core.exceptions import FieldError, ValidationError as DjangoValidationError |
| 9 | +from django.core.exceptions import FieldError |
9 | 10 | from django.core.validators import EMPTY_VALUES
|
10 | 11 | from django.forms.util import ErrorList
|
11 | 12 | from django.forms.formsets import BaseFormSet, formset_factory
|
12 | 13 | from django.utils.translation import ugettext_lazy as _, ugettext
|
13 |
| -from django.utils.text import get_text_list, capfirst |
14 |
| -from django.forms.widgets import HiddenInput |
| 14 | +from django.utils.text import capfirst |
15 | 15 |
|
16 |
| -from util import MongoFormFieldGenerator |
17 | 16 | from mongoengine.fields import ObjectIdField, ListField
|
18 | 17 | from mongoengine.base import ValidationError
|
19 | 18 | from mongoengine.connection import _get_db
|
20 | 19 |
|
| 20 | +from util import MongoFormFieldGenerator |
21 | 21 | from documentoptions import AdminOptions
|
22 | 22 |
|
23 |
| -import gridfs |
24 | 23 |
|
25 | 24 | def _get_unique_filename(name):
|
26 | 25 | fs = gridfs.GridFS(_get_db())
|
@@ -67,7 +66,6 @@ def construct_instance(form, instance, fields=None, exclude=None, ignore=None):
|
67 | 66 | filename = _get_unique_filename(upload.name)
|
68 | 67 | upload.file.seek(0)
|
69 | 68 | field.replace(upload, content_type=upload.content_type, filename=filename)
|
70 |
| - field.filename = 'blah blup' |
71 | 69 | setattr(instance, f.name, field)
|
72 | 70 |
|
73 | 71 | return instance
|
|
0 commit comments