Re: ImageField upload_to issue

2013-01-26 Thread Sammael
I'm terribly sorry, my bad. Of course, the second example is: class Image(models.Model): image = models.ImageField(upload_to = upload_path('i'), blank=True) thumbnail = models.ImageField(upload_to = upload_path('t'), blank=True) суббота, 26 января 2013 г., 3:58:55 UTC+4 п

Re: ImageField upload_to issue

2013-01-25 Thread Leonardo S
There is no t_upload_path 2013/1/25 Sammael > Hello, folks! > > Here is the relevant part of my model: > > def i_upload_to(instance, filename): > return '/'.join([strftime('i/%y%m/%d'), filename]) > > def t_upload_to(instance, filename): > return '/'.join([strftime('t/%y

ImageField upload_to issue

2013-01-25 Thread Sammael
Hello, folks! Here is the relevant part of my model: def i_upload_to(instance, filename): return '/'.join([strftime('i/%y%m/%d'), filename]) def t_upload_to(instance, filename): return '/'.join([strftime('t/%y%m/%d'), filename]) class Image(models.Model): ima

Re: imagefield upload_to

2011-05-11 Thread Brian Craft
solved this by moving it to the model clean() method, and using imagefield.file.open() and imagefield.file.read() to get the data for computing the other fields. On Wed, May 11, 2011 at 1:28 PM, Brian Craft wrote: > I have a model with an imagefield, and some fields that are computed > from the i

imagefield upload_to

2011-05-11 Thread Brian Craft
I have a model with an imagefield, and some fields that are computed from the image. I'm trying to override the "save" method to fill in the other fields. When I test this in the admin, there are two problems: first, the path (mymodel.image.path) doesn't honor the upload_to setting on the field. I

Admin save_model and ImageField (upload_to)

2011-01-10 Thread galago
Is there any way to get the full path of file, which will be uploaded? in save_model action i can get obj.image but it gives me only the file name. I want to get path with upload_to from model. Is it possible? I need it, because I want to make resizing on my image and make its name with hash to

Re: ImageField upload_to not workin

2008-11-17 Thread elm
Hi Javier, I am experiencing the same problem with 'upload_to'. Have you found the problem? Thx, elm On 14 nov, 18:31, Javier <[EMAIL PROTECTED]> wrote: > Hi, > > I've create a model: > > class ImagenesLugar(models.Model): >     archivo = models.ImageField(upload_to="imageneslugar/") >     te

Re: ImageField upload_to not workin

2008-11-14 Thread Peter Bengtsson
On Nov 14, 9:31 pm, Javier <[EMAIL PROTECTED]> wrote: > Hi, > > I've create a model: > > class ImagenesLugar(models.Model): >     archivo = models.ImageField(upload_to="imageneslugar/") >     texto = models.CharField(max_length=400) > > The thing is that when i create a new instance of this mode

ImageField upload_to not workin

2008-11-14 Thread Javier
Hi, I've create a model: class ImagenesLugar(models.Model): archivo = models.ImageField(upload_to="imageneslugar/") texto = models.CharField(max_length=400) The thing is that when i create a new instance of this model and assign instance.archivo to a file then instance.archivo.path does

Re: ImageField: upload_to

2008-09-18 Thread lingrlongr
worked like a charm. thx. On Sep 18, 5:21 pm, gnijholt <[EMAIL PROTECTED]> wrote: > I had to define the callable function before it gets called. > So in your case I'd put it right under class Product(models.model) > Then you should be able to just do: >   upload_to=get_image_path > > Cheers, > >

Re: ImageField: upload_to

2008-09-18 Thread gnijholt
I had to define the callable function before it gets called. So in your case I'd put it right under class Product(models.model) Then you should be able to just do: upload_to=get_image_path Cheers, On Sep 18, 10:20 pm, lingrlongr <[EMAIL PROTECTED]> wrote: > According to the documentation, I ca

ImageField: upload_to

2008-09-18 Thread lingrlongr
According to the documentation, I can make the upload_to argument a callable (which must receive 2 args): class Product(models.Model): number = models.CharField(max_length=20) image = models.ImageField(upload_to='') I want to build a path so it looks like this (with respect to MEDIA_URL)

Re: ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican
And in case anyone is interested in the results (a demo django gallery application) have a look here: http://saschashideout.de/wiki/DjangoGalleryTutorial/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican
Thanks, this is quite a good idea, the more I think about it the more I like it, because Images have only one Gallery, but I can change the gallery for every image if I want, which would lead to the problem of moving the image file from one directory to another. Your proposal seems to be the bette

Re: ImageField upload_to Parameter Problem

2007-07-04 Thread Martin Winkler
Am Wed, 04 Jul 2007 01:19:16 -0700 schrieb lastmohican <[EMAIL PROTECTED]>: > The Problem is, I want a dynamic image > storage path, something like MEDIA_ROOT+"images/" wont work with > hundreds of galleries, [...] Since your primary concern seems to be too many files in one directory, did you c

ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican
Hello everybody, I want to create a gallery app and I have a slight problem, my models.py code looks like this: ... class Gallery(models.Model): slug = models.SlugField(...) ... class Image(models.Model): ... gallery = models.ForeignKey(...) image = models.ImageField( uplo

Re: ImageField upload_to

2006-04-05 Thread Max Battcher
timster wrote: > Should the super() method work even though I'm not using MR? No. super().save() only works in MR. You'll need the _pre_save() and _post_save() hooks in .91 or trunk. -- --Max Battcher-- http://www.worldmaker.net/ "I'm gonna win, trust in me / I have come to save this world /

Re: ImageField upload_to

2006-04-05 Thread Max Battcher
timster wrote: > Should the super() method work even though I'm not using MR? No. super().save() only works in MR. You'll need the _pre_save() and _post_save() hooks in .91 or trunk. -- --Max Battcher-- http://www.worldmaker.net/ "I'm gonna win, trust in me / I have come to save this world /

Re: ImageField upload_to

2006-04-05 Thread timster
Thanks for the reply Ian. I seem to have solved this for the most part. The second message in that thread was very helpful. I was able to use that solution almost exactly. I added the following save() method to my model: def save(self): if self.image: import shutil from os im

Re: ImageField upload_to

2006-04-04 Thread Ian Clelland
On 4/4/06, timster <[EMAIL PROTECTED]> wrote: > What I would like to do is store the image in a subfolder corresponding > to the gallery_id. If "Subaru" is gallery_id 1 and "Audi" is gallery_id > 2, I would want it to look like this: > > gallery/1/subaru1.jpg > gallery/2/audi1.jpg > > Is this poss

ImageField upload_to

2006-04-04 Thread timster
I'm trying to create a simple image gallery. Here's what my models look like. It's very simple, a gallery can have one or more images. class Gallery(meta.Model): name = meta.CharField(maxlength=50) class Image(meta.Model): gallery = meta.ForeignKey(Gallery)] image = meta.ImageField(u