1๐
I think you need update form like this:
def purchase(request):
if request.method == 'POST':
print dict(request.POST.iterlists())
form = forms.PurchaseForm(request.POST request.FILES or None)
UPD for comment:
for saving try too add this in url
:
from django.conf.urls.static import static
urlpatterns = [...] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
and check media
settings:
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
this is for admin, add method for model, which use image field:
def admin_image(self):
return "<img src='%'/>" % self.your_image_field.url
admin_image.allow_tags = True
and register list_display=('admin_image',)
in admin.py
๐คIvan Semochkin
Source:stackexchange.com