Questions tagged [imagefield]

A place to store or display a graphic image.

"Image field" is a generic term that typically would belong in a or setting such as:

It appears to be a synonym for .

342 questions
1
vote
2 answers

Django not getting images that are uploaded to sqlite

Images are not coming into template. settings.py MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') html {% for question in question_list %} models.py class NewQuestion(models.Model): category =…
1
vote
1 answer

Django - How to Save ImageField Even if Form is Not Valid

I have a fairly standard model and form. I have some mandatory fields with an ImageField. When the user choose an image and doesn't field the mandatory fields, the image isn't saved and the user needs to 're-upload' it again. As the row in the…
mrmuggles
  • 2,081
  • 4
  • 25
  • 44
1
vote
1 answer

Django 1.7 - ImageField, my image is not being uploaded to MEDIA_URL

So I have spent a number of hours trying to figure this out and there's tonnes of examples on the topic but none have them have been able to solve my problem so I'm creating another question. Basically I have a form with an ImageField and when I try…
Programmingjoe
  • 2,169
  • 2
  • 26
  • 46
1
vote
1 answer

Correcting ImageField link

Using django 1.8 I have # model.py def signatures_path(instance, filename): return '{}/signatures/{}/{}'\ .format(settings.MEDIA_ROOT, instance.id, filename) class Des(models.Model): user = models.OneToOneField(User) signature…
max
  • 9,708
  • 15
  • 89
  • 144
1
vote
1 answer

Django if ImageField is left blank or is equal to none return last image uploaded

I'm trying to create an image gallery where people are able to upload multiple images. There are 8 fields for uploading images. The problem that I have is that when a user uploads less that 8 images. If one of the imageFields are left blank this…
Ryan113
  • 676
  • 1
  • 10
  • 27
1
vote
1 answer

Problem saving imagefield using hooks in Drupal 6

Here's my custom module; it basically fetches a file from a particular URL, saves it on temporary folder and then i want it to modify a cck field of type 'file' (field name being : field_video_thumb) : function mymodule_nodeapi(&$node, $op)…
Disco
  • 4,226
  • 11
  • 58
  • 76
1
vote
0 answers

cStringIO to django FileField or ImageField

I'm trying to save image using cStringio through django FileField. I tried File and ContentFile Also I tried to switch from FileField to ImageField The file always flushes on the disk with the same size(greater than original image), but the image…
Aleksandr
  • 71
  • 6
1
vote
1 answer

retrieving uploaded images with django's ImageField

this is the code in my models file: from django.db import models class Studio(models.Model): ..... ..... metroimage = models.ImageField(upload_to='images', blank=True) this is the code on the template file: {% for place in studio %} …
momo
  • 1,045
  • 3
  • 9
  • 18
1
vote
1 answer

Cannot identify image file ImageFieldFile

I'm using django with Python, in my models.py I declared a Tournament model with and attribute image, this is the save method: import datetime from django.db import models from django.utils import timezone from tinymce.models import HTMLField from…
1
vote
2 answers

Set ImageField default value to random image out of a list of images in Django

I have some images inside the static directory and want to create a model that has a ImageField. I want to set the default field to any one of those images. I have tried using this - def randomImage(): return ImageFile('media/blog/image/' +…
user3324847
  • 25
  • 2
  • 7
1
vote
1 answer

How to display uploaded django ImageField in django/mezzanine template?

I don't have a clue here. I've set up a form with ImageField to upload user images via frontend and upload is working fine, though I can't find a way to retrieve the pics url and display it in a template. I did run python manage.py collectstatics.…
1
vote
0 answers

How we use widget in imagefield in django form

I want to use custom widget for imagefield in django form like here. I am also use crispy form if in crispy form it possible pls let me know how we can do that? Thanks in advance!!
Kartik
  • 65
  • 9
1
vote
1 answer

Django, two ImageField pointing to the same file

I'd like my two image fields point to the same image. At one time, I'll have one image field populated. At later time, I'd like another imageField to point to the same file. (If the first one changes, the second one gets updated as well) The file…
eugene
  • 39,839
  • 68
  • 255
  • 489
1
vote
1 answer

ImageField is not defined

I'm building a personal photography site using Django. I'm working on the models.py. My app is called "photoViewer", the site is called "photoSite". However, when I run makemigrations, I'm getting: NameError: name 'ImageField' is not defined I have…
jerryh91
  • 1,777
  • 10
  • 46
  • 77
1
vote
1 answer

WP: acf image fields & simple lightbox plugin integration

I'm trying to integrate the Simple Lightbox plugin into Advanced Custom Fields image fields. Basically I want any images on a page (populated via acf image fields) to open in the lightbox when clicked, and also be grouped together with all other…
dadra
  • 153
  • 1
  • 3
  • 15