imagefield Questions

3

Solved

In my case I allow user to upload an avatar picture and use user_id as filename, simply. So there will be 1.jpg, 2.jpg, etc. However I found if I upload a new avatar for some account that already ...
Glyceric asked 9/2, 2012 at 16:37

15

Solved

I wanna add ImageField to my Product model and upload it to my media_cdn directory but when I migrate my base to my model.py it returns the below error: django.db.utils.IntegrityError: NOT NULL con...
Shapeless asked 11/3, 2017 at 8:48

4

I am trying to get ImageField absolute path in Django view so I can open the image, write on it something and then serve it to user. I have problem getting absolute path for the image which is sav...
Emaemaciate asked 2/4, 2013 at 12:51

4

Solved

I'm overriding Django's model delete method in order to delete orphan files in the disk for image fields, something like this: class Image(models.Model): img = models.ImageField(upload_to=get_ima...
Cantharides asked 6/3, 2015 at 9:53

2

Solved

I am relatively new to django. I am using ImageForm to get the image path from the user. class EditProfileForm(ModelForm): username = CharField(label='User Name', widget=TextInput(attrs={'class': ...
Dao asked 31/7, 2014 at 3:26

3

model: class Logo(models.Model): media = models.ImageField(upload_to='uploads') def __unicode__(self): return self.media.url view: class LogoEdit(UpdateView): model = Logo template_name =...
Boylston asked 6/3, 2015 at 16:5

3

this is a followup to my question here: ImageField / FileField Django form Currently unable to trim the path to filename In my Django app, there is an imagefield uploaded to S3 After trim the imag...
Primateship asked 18/1, 2018 at 5:25

13

Solved

I am using 1.2.5 with a standard ImageField and using the built-in storage backend. Files upload fine but when I remove an entry from admin the actual file on the server does not delete.
Zenia asked 21/3, 2011 at 1:19

3

Solved

This is killing me! I'm using django-filebrowser, and I want to create a gallery app that leverages it's upload capabilities to manage images. I have a Gallery model that allows the user to sele...
Schwarzwald asked 23/11, 2010 at 16:54

5

Solved

I have a django app which allows users to submit an image with it. Right now my model looks like class Posting(models.Model): title = models.CharField(max_length=150) images = models.ForeignKey...
Prescriptive asked 31/3, 2015 at 4:2

2

Solved

I am updating some of fields in model from views.py file. All other fields are updated properly when I use Profile.objects.filter(id=user_profile.id).update( bio=bio, city=city, date_of_birth=d...
Callow asked 4/1, 2019 at 14:11

8

In Django, if you have a ImageFile in a model, deleting will remove the associated file from disk as well as removing the record from the database. Shouldn't replacing an image also remove the unn...
Hypabyssal asked 9/12, 2010 at 2:0

3

There are two models: Product and Picture. Each Product can have several Pictures. I have questions when I want to create a Product using POST. How to POST a nested object containing a ImageField l...
Strander asked 22/1, 2015 at 16:0

2

Is there a Django widget for ImageFields that provides the option to either upload an image or provide a url? I'm thinking like Summernote does (if you click the image icon) in its examples I've ...
Postcard asked 24/12, 2016 at 23:4

1

I have a web scraper that I want to download an image of the page it's scraping and save it as a "screenshot" ImageField in a Django model. I am using this code: def save_screenshot(source,screens...
Diallage asked 30/12, 2016 at 22:29

3

Solved

I've just started to use Django and I haven't found a lot of info on how to display an imageField, so I made this: models.py: class Car(models.Model): name = models.CharField(max_length=255) pric...
Hyoscyamus asked 24/7, 2013 at 23:3

1

Currently I am developing a image gallery django project. The user can upload images, and later upload a 'result' to each of the images. I know that I have to override the update(...) function, but...

2

Solved

I would like to upload images to the media root based on the field values given by the Django admin user. Here is the code that I've written and I know that the upload_to parameter is causing the p...
Blackness asked 20/5, 2015 at 12:23

2

Solved

Given a django image field, how do I create a PIL image and vice-versa? Simple question, but hard to google :( (I'm going to use django-imagekit 's processor to rotate an image already stored as ...
Darby asked 26/2, 2014 at 8:36

2

Solved

I've been going around in circles for hours with this. I have a UserProfile model with profile_pic ImageField. I saved the user photo and now I want to display it, but nothing works. I went through...
Decompress asked 22/3, 2012 at 20:42

1

I have this model: class UserProfile(models.Model): #.......... photo = models.ImageField(upload_to = get_upload_file_name, storage = OverwriteStorage(), blank = True, null = True, height_fie...
Trimerous asked 28/3, 2014 at 11:42

1

models.py: class UserProfile(models.Model): photo = models.ImageField(upload_to = get_upload_file_name, storage = OverwriteStorage(), default = os.path.join(settings.STATIC_ROOT,'images','gene...
Dowel asked 22/3, 2014 at 18:40

2

I am building a Django data model and I want to be able to store an array of ImageFields. Is it possible? mainimage = models.ImageField(upload_to='img', null = True) images = models.?? Thanks.
Scutch asked 16/7, 2013 at 9:34

1

Solved

I have made several apis in djangorestframework. This I could test both with the html form of the api as with curl in commandline. Now I have an api to a Model with one off the fields an ImageFiel...
Downer asked 9/7, 2012 at 15:52

2

Solved

I've got a model Picture with an ImageField. When deleting an instance of Picture, the file set in the ImageField is not deleted. Is it a bug? How can I do it?
Omaomaha asked 12/7, 2012 at 16:31

© 2022 - 2024 — McMap. All rights reserved.