Skip to content

Commit cecc8ad

Browse files
author
David Burke
committed
media files in demo
1 parent 1ffd551 commit cecc8ad

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
FROM python:3.5
2+
ENV PYTHONUNBUFFERED 1
23

34
RUN mkdir -p /usr/src/app
45
WORKDIR /usr/src/app
56

67
COPY setup.py /usr/src/app/
78
RUN pip install -e .
89

9-
COPY . /usr/src/app
10-
11-
# include RUN for tests as well as CMD so that all test dependencies are
12-
# installed on the image and wont have to be downloaded again every time
13-
# the image is RUN
14-
CMD python setup.py test
10+
COPY . /usr/src/app

simple_import/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def set_field_from_cell(import_log, new_object, header_row_field_name, cell):
302302
new_object.simple_import_m2ms[header_row_field_name] = cell
303303
elif isinstance(field, ForeignKey):
304304
related_field_name = RelationalMatch.objects.get(import_log=import_log, field_name=field.name).related_field_name
305-
related_model = field.related.parent_model
305+
related_model = field.remote_field.parent_model
306306
related_object = related_model.objects.get(**{related_field_name:cell})
307307
setattr(new_object, header_row_field_name, related_object)
308308
elif field.choices and getattr(settings, 'SIMPLE_IMPORT_LAZY_CHOICES', True):

simple_import_demo/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@
9696
# https://docs.djangoproject.com/en/1.7/howto/static-files/
9797

9898
STATIC_URL = '/static/'
99+
MEDIA_URL = '/media/'

simple_import_demo/urls.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from django.conf.urls import include, url
22
from django.contrib import admin
3+
from django.conf import settings
4+
from django.conf.urls.static import static
35

46
urlpatterns = [
57
url(r'^admin/', include(admin.site.urls)),
6-
url(r'^simple_import/', include('simple_import.urls'))
7-
]
8+
url(r'^simple_import/', include('simple_import.urls')),
9+
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 commit comments

Comments
 (0)