Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading an Image through Admin in Django
    text
    copied!<p>I am trying to upload an image through the Django Admin Panel. I am running on Google App Engine and using the filetransfers plugin (not sure if either is relevant to the problem I am having).</p> <p>From my modelys.py:</p> <pre><code>from django.db import models # Create your models here. class CarouselItem (models.Model): caption = models.CharField(max_length=200,blank=True) order = models.IntegerField() carousel_image = models.ImageField(upload_to='uploads/carousel_image/%Y/%m/%d/') def __unicode__(self): return self.caption </code></pre> <p>From admin.py:</p> <pre><code>from carousel.models import CarouselItem from django.contrib import admin from imperavi.admin import ImperaviAdmin class carouselAdmin(ImperaviAdmin): list_display = ('caption','order') admin.site.register(CarouselItem, carouselAdmin) </code></pre> <p>The error I am getting is "No module named Image". I don't have PIL installed. Do I need to install it to enable this functionality?</p> <p>Update: here is traceback that caused error:</p> <pre><code>Environment: Request Method: POST Request URL: http://127.0.0.1:8000/admin/carousel/carouselitem/add/ Django Version: 1.3.1 Python Version: 2.7.2 Installed Applications: ['django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.sessions', 'djangotoolbox', 'autoload', 'dbindexer', 'django.contrib.staticfiles', 'portfolio', 'EBoardMembers', 'Calendar', 'filetransfers', 'positions', 'imperavi', 'chunks', 'carousel', 'djangoappengine'] Installed Middleware: ('autoload.middleware.AutoloadMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/contrib/admin/options.py" in wrapper 307. return self.admin_site.admin_view(view)(*args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/utils/decorators.py" in _wrapped_view 93. response = view_func(request, *args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/views/decorators/cache.py" in _wrapped_view_func 79. response = view_func(request, *args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/contrib/admin/sites.py" in inner 197. return view(request, *args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/utils/decorators.py" in _wrapper 28. return bound_func(*args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/utils/decorators.py" in _wrapped_view 93. response = view_func(request, *args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/utils/decorators.py" in bound_func 24. return func(self, *args2, **kwargs2) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/db/transaction.py" in inner 217. res = func(*args, **kwargs) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/contrib/admin/options.py" in add_view 864. if form.is_valid(): File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/forms.py" in is_valid 121. return self.is_bound and not bool(self.errors) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/forms.py" in _get_errors 112. self.full_clean() File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/forms.py" in full_clean 267. self._clean_fields() File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/forms.py" in _clean_fields 282. value = field.clean(value, initial) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/fields.py" in clean 503. return super(FileField, self).clean(data) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/fields.py" in clean 163. value = self.to_python(value) File "/Users/Zach/Documents/Cornell/Activities/MICC/new_website/MICC_app_engine/django/forms/fields.py" in to_python 528. import Image Exception Type: ImportError at /admin/carousel/carouselitem/add/ Exception Value: No module named Image </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload