1. Dmitri Lebedev
  2. django-inline

Commits

Dmitri Lebedev  committed 351905f

fix: can save file uploads

  • Participants
  • Parent commits 97bfefc
  • Branches default

Comments (0)

Files changed (2)

File example/django_inline/templates/inline-form.html

View file
  • Ignore whitespace
 {% load i18n %}
-<form action="{% url django_inline_update %}" method="POST" class="django_inline">
+<form action="{% url django_inline_update %}" method="POST" class="django_inline" enctype="multipart/form-data">
 	{% csrf_token %}
 	{{ form.as_inline }}
 	&nbsp;

File example/django_inline/views.py

View file
  • Ignore whitespace
     Checks user permissions and saves the data in the model.
     """
     if request.user.has_perm('%s.can_edit' % obj.__class__.__name__, obj):
-        form = FormClass(data=request.POST, instance=obj)
+        form = FormClass(data=request.POST, files=request.FILES, instance=obj)
         form.save()
 
     return render_to_response(