image handling

2015-03-24 Thread akash . patni
hi.. Can anyone please tell me how to handle old image after uploading new image. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, I think you'll have to be more specific, what do you want to do with the old image? Delete it? Use it again? Regards, Andréas 2015-03-24 10:08 GMT+01:00 : > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > > -- > You received this message because you

Re: image handling

2015-03-24 Thread akash . patni
Hi , I want to delete the old image. On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because you are subscribed to the Google Groups "Django

Re: image handling

2015-03-24 Thread akash . patni
This is my model class User(models.Model): first_name=models.CharField(verbose_name = "First Name *",max_length=20,blank=False) last_name=models.CharField(verbose_name = "Last Name *",max_length=20,blank=False) username=models.EmailField(verbose_name = "Email *",max_length=30,blank=F

Re: image handling

2015-03-24 Thread akash . patni
This is my edit profile function in view def edit_profile(request): if 'username' in request.session: user_id=request.POST.get('id') user_id=request.GET.get('id') usr_obj=User.objects.get(id=int(user_id)) if request.method=="POST": regform=

Re: image handling

2015-03-24 Thread akash . patni
hi any answer On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: image handling

2015-03-24 Thread aRkadeFR
When do you want to delete the old image? On 03/24/2015 10:59 AM, akash.pa...@ranosys.com wrote: Hi , I want to delete the old image. On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: hi.. Can anyone please tell me how to handle old image after uploading

Re: image handling

2015-03-24 Thread akash . patni
When i edit image that is when i upload new image,the old image should get deleted On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because yo

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, Ok, so what you should do is add a signal to pre save and then delete the old image if the new image is attached. Something like this should work: from django.core.files.storage import default_storage as storage from django.db.models.signals import pre_save def image_delete(sender, instanc

Re: image handling

2015-03-24 Thread Akash Patni
Hey, I am new to django. I have other feilds also other than image field in my form, so will you please tell me how to use above mentioned function in edit_profile function in view, Can i call another function from another function in views.py, if yes please tell me On Tue, Mar 24, 2015 at 6:11 PM

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, You shouldn't do it in the view, do it in the database model instead. It won't do anything to any other fields than the image field the way I wrote the function (all other fields are untouched). The reason you shouldn't do it in the view, is because if you were to update the image any other p

Re: image handling

2015-03-24 Thread Akash Patni
is there any other changes that i have to made in model like how this above mentioned function will be call. Please suggest On Tue, Mar 24, 2015 at 6:43 PM, Andreas Kuhne wrote: > Hi, > > You shouldn't do it in the view, do it in the database model instead. It > won't do anything to any other f

Re: image handling

2015-03-24 Thread Akash Patni
i had made the changes in model .py but its not working here is model.py from django.db import models import django.forms as forms from virtualenv import REQUIRED_FILES from _mysql import NULL from datetime import datetime, date, time, timedelta import time import calendar from django.contrib.au

Re: image handling

2015-03-24 Thread Andreas Kuhne
First, make sure that the whitespace is the same in all of your methods (in python whitespace is significant, which means that you should indent all files the same amount, I wrote my example in my email, so I only indented twice, you seem to have 4 blankspaces in your file, so make sure the indenta

Re: image handling

2015-03-24 Thread Akash Patni
Hi, I have added the code to my __init__.py file but still its not working. __init__.py from django.core.files.storage import default_storage as storage from django.db.models.signals import pre_save from django.db import models import django.forms as forms from django.contrib.auth.models import U

Re: image handling

2015-03-24 Thread Akash Patni
Hi, Can i use this method in my model.py def save(self, *args, **kwargs): try: this = MyModelName.objects.get(id=self.id) if this.MyImageFieldName != self.MyImageFieldName: this.MyImageFieldName.delete() except: pass super(MyModelName, self).save(*args, **kw

Re: image handling

2015-03-25 Thread Andreas Kuhne
Hi, No, that is not correct. The storage parameter has nothing to do with this. Also, why are you not using an ImageField instead of the FileField? Also you have to put all methods with "self" as a parameter with the class itself. Self is a pointer to the instance of the class, so it needs to be w

Re: image handling

2015-03-25 Thread Akash Patni
Hi.. ok will not give storage parameter, but how the function save will called.Will it be called automatically when i edit image. I have used upload function to call a function which change the name of the image and save it to the database. On Wed, Mar 25, 2015 at 1:44 PM, Andreas Kuhne wrote:

Re: image handling

2015-03-25 Thread Andreas Kuhne
Hi again, When you add the save function to a class, it overrides the builtin function that comes with the django db model. So it will be called everytime you call save on your model (which is called when you create or resave your model). Your form is a modelform, and somewhere in the code you sho

Problems about image handling

2015-11-21 Thread rylanlee
Here is what I desire: First, in topicWords.py, a image of word cloud will be generated for each user(so each one can have a unique image and the image is not through uploading but generating in the backend ). And then I want to display it on the html. Now I can generate the image succesfully, b

Image handling - Custom image field?

2009-08-01 Thread TiNo
Hi, I am working on an image gallery. I am making use of django-imagekit. My site is hosted at a VPS, with 80 MBs of memory. I use NginX with fastcgi. What I am trying to accomplish is the following: 1. A logged-in user goes to an /upload page, where information about the ftp server is listed 2. T

Re: Image handling - Custom image field?

2009-08-03 Thread Peter Bengtsson
I would write a management command and let a cron job fire off to run it. See this for how to write management commands: http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ Then your cron job can look something like this: */5 * * * * python /path/to/manage.py copyfromftp >> /de

Re: Image handling - Custom image field?

2009-08-12 Thread TiNo
On Mon, Aug 3, 2009 at 12:53, Peter Bengtsson wrote: > > I would write a management command and let a cron job fire off to run > it. > See this for how to write management commands: > http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ > > Then your cron job can look something

Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Asif Khan
I developed application that uses an ImageField in Django==2.0.7 with Pillow 5.2.0 there is no issue on development machine but facing problem on production server giving "Server Error 500" Exception Value: No module named 'PIL' which I have not used or called in my code. I new to Python and Dj

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Jason
sounds like pillow wasn't installed in your prod environment. how did you set that servcer up? On Saturday, July 21, 2018 at 11:56:12 AM UTC-4, Asif Khan wrote: > > I developed application that uses an ImageField in Django==2.0.7 with > Pillow 5.2.0 there is no issue on development machine bu

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Asif Khan
Pillow is install in my production environment and the same Pillow 5.2.0 on both development and production. On Saturday, July 21, 2018 at 9:39:36 PM UTC+5, Jason wrote: > > sounds like pillow wasn't installed in your prod environment. how did you > set that servcer up? > > > > On Saturday, Ju

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Jason
are you sure? open up a python shell on the server and do from *PIL import image* If it works, then the problem is somewhere else. If you get an error, its a missing dependency. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Asif Khan
Oh dear I checked and found that Pillow was install in Python3.5 where as production setup is for Python3.6 so Pillow was installed by pip3.5 but not with pip3.6 which I have installed now. the problem is resolved. Thanks for make me focus on this. On Saturday, July 21, 2018 at 9:58:55 PM UTC+5

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Melvyn Sopacua
On zaterdag 21 juli 2018 19:08:03 CEST Asif Khan wrote: > Oh dear I checked and found that Pillow was install in Python3.5 where as > production setup is for Python3.6 so Pillow was installed by pip3.5 but not > with pip3.6 which I have installed now. Have a look at pyenv[1]. Relying on "versioned

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread mottaz hejaze
thats why they invented virtualenv On Sat, 21 Jul 2018, 19:36 Melvyn Sopacua, wrote: > On zaterdag 21 juli 2018 19:08:03 CEST Asif Khan wrote: > > > Oh dear I checked and found that Pillow was install in Python3.5 where as > > > production setup is for Python3.6 so Pillow was installed by pip3.5

Re: Djando 2.0.7 image handling problem on production server

2018-07-21 Thread Gerald Brown
I use pyvenvwrapper which I find is even better than pyenv.  Once a project is created just enter "workon proj-name" and it will take you to the project directory.  It can be found at: https://github.com/solovyevn/pyvenvwrapper On Sunday, 22 July, 2018 10:30 AM, mottaz hejaze wrote: thats wh

Re: Djando 2.0.7 image handling problem on production server

2018-07-22 Thread Melvyn Sopacua
On zondag 22 juli 2018 04:30:09 CEST mottaz hejaze wrote: > thats why they invented virtualenv Just so you know: pyenv is a wrapper around virtualenv, which can pin a project to a python version and just makes virtual environments easier to work with. There's also virtualenvwrapper for somewhat

Admin Image Handling - ability to display thumb and delete an image - one solution

2009-02-09 Thread phoebebright
In case this helps anyone, here is one implementation I have 4 pictures attached to each record but would work the same if only one. Uses sorl-thumbnails and based on snippet here: http://www.djangosnippets.org/snippets/934/ written by baumer1122 In models.py - used standard mo