django-imagefield

Django Imagefield not working properly via ModelForm

I'm certain I'm doing something really obviously stupid, but I've been trying to figure it out for a few hours now and nothing is jumping out at me. I'm using a ModelForm so I can expose a few fields from a model for editing. 2x ImageField, 1x TextField. The Form is processed and the TextField works. The two ImageFields do not work and ...

how can I change(update) an existing avatar to a new one using Django modelform?

Hi, I encounter a problem. In my user models there is an atrrbution: user.avatar = ImageField ('avatar', upload_to=AVATAR_TEMP_DIR, blank=True, null=True) then i use a modelform as an create user form. And the avatar is uploaded corrcet. Which upload to AVATAR_TEMP_DIR, then I move the avatar into AVATAR_ORIGINAL_PATH and make user.avata...

Django: When saving, how can you check if a field has changed?

In my model I have : class Alias(MyBaseModel): remote_image = models.URLField(max_length=500, null=True, help_text="A URL that is downloaded and cached for the image. Only used when the alias is made") image = models.ImageField(upload_to='alias', default='alias-default.png', help_text="An image representing the alias") de...

Django: add image in an ImageField from image url

Hi, please excuse me for my ugly english ;-) Imagine this very simple model : class Photo(models.Model): image = models.ImageField('Label', upload_to='path/') I would like to create a Photo from an image URL (i.e., not by hand in the django admin site). I think that I need to do something like this : from myapp.models import Ph...

Django ImageField Override the File Collision Code

Hi, I would like to have 2 ImageFields in a Model. being the one where the user uploads an image being one where we have a copy of that image, but using the Same File. Note: I am simplfying the reason for the two fields. Apart from Creating a new ImageField field type is there any way to stop the ImageField adding a _ to the filena...

Create & return a default ImageFieldFile from inside a function

In my UserProfile model I would like to have a function which returns either the user's ImageFileField object or a default image if the user has not uploaded their own. For example: class UserProfile(models.Model): pic = models.ImageField('Headshot',blank=True, upload_to=get_path_and_filename) def...

Optional ImageField (Django)

Hi all, I'm having a problem with an ImageField in one of my models. It is set to blank=True, null=True (it is optional.) When I loop through a list of objects and use object.thumbnail.url, I get "Caught an exception while rendering: The 'thumbnail' attribute has no file associated with it." This only happens if no thumbnail has bee...

Getting invalid image error in Django, but PIL is installed and passes all tests

So I've finally successfully installed PIL (after many difficulties) on RHEL5 with Django (development version) and Python 2.6 installed at /opt/python2.6. Running selftest.py shows that everything appears to be installed correctly: $ python2.6 selftest.py 57 tests passed. I can upload .png files and .gif files without difficulties,...

How to make Admin link associated with imagefield display imagefield

I am hoping to use an imagefield in one of my Django models, and therefore created a very simple model, adjusted my settings file, uploaded the imagefield by adding the image from within the Admin application. Unhappily, the link attached to the image field in the Admin application does not provide the stored image, no matter what I try...

How to extend an ImageField in my own django admin template?

Hello, I would like to make a custom admin page for one of my application with django. I've created a change_form.html and fieldset.html in admin/myapp/mymodel of my template folder. I am now able to customize the page. mymodel has an ImageField and I would like to display this image on the page. I guess this is possible because the Im...

Django admin: Add a "remove file" field for Image- or FileFields

I was hunting around the Internet for a way to easily allow users to blank out imagefield/filefields they have set in the admin. I found this: http://www.djangosnippets.org/snippets/894/. What was really interesting to me here was the code posted in the comment by rfugger: remove_the_file = forms.BooleanField(required=False) def save...

Django: Password protect photo url's?

From my Django application I want to serve up secure photos. The photos are not for public consumption, I only want logged in users to have the ability to view them. I don't want to rely on obfuscated file id's (giving a photo a UUID of a long number) and count on that being hidden in my media folder. How would I store a photo securel...

Overriding _get_url() from ImageField

Hi, I'm looking to the best way to overriding the _get_url method from ImageField, I need to customize the url since I don't want the default returned url (I distribute this image trhough a view to manage ACL on it so the url based on the MEDIA_ROOT is wrong). Should I have to create my own ImageField ? or is there a solution using les...

Images are not being stored?? - Django

Hi folks, These are my following settings: MEDIA_ROOT = '/home/webapps/test_project/media/' MEDIA_URL = 'http://192.168.0.2:8090/site_media/' ADMIN_MEDIA_PREFIX = '/media/' These are my model fields: large = models.ImageField(blank=True, null=True, upload_to="images") thumb = models.ImageField(blank=True, null=True, upload_to="image...

How pyamf.amf3.ByteArray save to ImageField?

I'm getting object 'pyamf.amf3.ByteArray' How can I save it to ImageField ? ...

Django: Lowercasing filename of the input Image File

I have a model: class Foo(models.Model): poster = models.ImageField(u"Poster", upload_to='img') I'm using the admin to upload posters and save Foo objects. I now need to find a way to lowercase the filename before save. For instance POSTER.png or Poster.png or poster.PNG should be lowercased to poster.png. What would be the easie...

How do i migrate a model containing an ImageField from django-imagekit using django-south?

I find this documentation extremely confusing: http://south.aeracode.org/docs/customfields.html If someone could walk me through this or at least give a full example, I would be very grateful. ...

Django thumbnails suggestion

Looking for an alternate to django-imagekit. django-imagekit with django-cumulus causes loads of timeout issues and makes apps very inconsistent. Are there any alternatives that you can suggest that you have used in your previous projects? ...