Re: How to use ImageField to save images to dynamic path

2008-04-23 Thread PENPEN
I'm not clear how it could be. Could you please explain it in detail? Many thanks! /BRs On Apr 23, 1:34 pm, "Eric Liu" <[EMAIL PROTECTED]> wrote: > Why don't you set 'images/' as a variant.then you can change it dynamically > > 2008/4/23, Rishabh Manocha <[EMAIL PROTECTED]>: > > > > > Yea, I

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread Eric Liu
Why don't you set 'images/' as a variant.then you can change it dynamically 2008/4/23, Rishabh Manocha <[EMAIL PROTECTED]>: > > > Yea, I don't think the method I described would work for directories > (or at-least I can't figure out how). It does, however, work if you > want to add something to a

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread Rishabh Manocha
Yea, I don't think the method I described would work for directories (or at-least I can't figure out how). It does, however, work if you want to add something to a filename before saving it. The code I use is: request.FILES['resume']['filename'] = request.POST['empid'] + "_" +

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread PENPEN
How do you mean of changing request.FILES there itself? I tried to add the directory to request.FILES but failed. Django ignored the directory and savethe image to the MEDIA_ROOT not MEDIA_ROOT/images. class Thing(models.Model): photo = models.ImageField( upload_to='images/',

Re: How to use ImageField to save images to dynamic path

2008-04-21 Thread Rishabh Manocha
I don't know if this answers your specific question, but this is being worked on, apparently - http://code.djangoproject.com/ticket/5361. I had a similar requirement, where I wanted to dynamically append a model field to the filename before saving it. I ended up getting the model field's value

How to use ImageField to save images to dynamic path

2008-04-20 Thread PENPEN
I defined such a model: class Thing(models.Model): photo = models.ImageField( upload_to='images/', blank=True, null=True) Here is the form for this model: class ThingForm(ModelForm): class Meta: model = Thing Now it could handle the image upload request and save images

Re: ImageField links in admin going no-where

2008-04-06 Thread bergstyle
I got this working. My media url wasn't setup right. If anyone else encounters this issue. I setup my media_url in the settings file and then I point /media to that directory in the web server config. Then for the admin files I created a symlink to them from inside my regular media directory.

ImageField links in admin going no-where

2008-04-06 Thread bergstyle
One of my models has an ImageField. The image file uploading and removing works correctly but in the Admin interface it display a link to see the image. Here's what the link looks like: http://admin.domain-dev.com/admin/appname/product/6/product_images/raw/bptestimage.jpg The problem is I just

Re: Newbie here, needs help with ImageField

2008-03-10 Thread foxbunny
On Mar 10, 2:10 pm, Michael Newman <[EMAIL PROTECTED]> wrote: > Passing your error along would be helpful because it will help us > pinpoint exactly what part of your code is having issues. Python > traceback is amazing helpful in that if you follow its path, even > though it might not look like

Re: Newbie here, needs help with ImageField

2008-03-10 Thread Michael Newman
Passing your error along would be helpful because it will help us pinpoint exactly what part of your code is having issues. Python traceback is amazing helpful in that if you follow its path, even though it might not look like anything initially, it will lead you to what the problem is. This is

Newbie here, needs help with ImageField

2008-03-10 Thread foxbunny
Hi, I've read the tutorial, and bits of docs here and there. I would like to thank the great Django community for making this a splendid learning experience! So, I felt confident enough to start writing a simple image gallery app. Here's the code for the main app's models.py.

Re: Newforms-admin Imagefield issues

2008-02-22 Thread Michael Newman
How are you getting the URL for the image? I am not having this same issue using get_image_url in the templates. On Feb 20, 1:23 pm, Aaron Fay <[EMAIL PROTECTED]> wrote: > Hey List,In newforms-admin, when I use an ImageField and specify > (upload_to="myfolder") o

Unable to modify model in admin without change ImageField.

2008-02-15 Thread Justin
Related ticket (currently closed): http://code.djangoproject.com/ticket/871 At some point I have lost the ability to save this model in the admin interface as it refuses to honor blank=True in the model. There is already an image saved to each of these models which I do not want to change, but

Re: ImageField Example

2008-01-20 Thread Alex Koshelev
und anything - any idea how I > save images using Django? I've put an ImageField in my model with the > path to where it should save, but how do I tell Django to save it when > a form is submitted? I'm using NewForms btw. > > Cheers, > Chris --~--~-~--~~--

Re: ImageField Example

2008-01-19 Thread Kenneth Gonsalves
On 19-Jan-08, at 6:02 PM, Darthmahon wrote: > Does anyone have a working example of uploading images using Django? > I've looked extensively and haven't found anything - any idea how I > save images using Django? I've put an ImageField in my model with the > path to where it

Re: Incorrect ImageField get_file_url() output on Windows?

2008-01-19 Thread Alex Koshelev
What path is saved into field? On 19 янв, 23:38, tom <[EMAIL PROTECTED]> wrote: > I'm doing local development on XP, and with the exeception of this, it > has worked really well. In my settings.py, I have > > MEDIA_ROOT = 'C:/worker/cms/media/' > MEDIA_URL = 'http://localhost:8000/docs/' >

Incorrect ImageField get_file_url() output on Windows?

2008-01-19 Thread tom
I'm doing local development on XP, and with the exeception of this, it has worked really well. In my settings.py, I have MEDIA_ROOT = 'C:/worker/cms/media/' MEDIA_URL = 'http://localhost:8000/docs/' ADMIN_MEDIA_PREFIX = '/media/' and then in a model: imagefile =

ImageField Example

2008-01-19 Thread Darthmahon
Hey, Does anyone have a working example of uploading images using Django? I've looked extensively and haven't found anything - any idea how I save images using Django? I've put an ImageField in my model with the path to where it should save, but how do I tell Django to save it when a form

Re: Maximum ImageFIeld width

2008-01-08 Thread David Grant
I'm not an expert, actually I've just started looking into the django source recently. My first idea would be to inherit from the ImageField Field, call it MyImageField. In MyImageField override the validate method and if the width isn't what you want, raise

Maximum ImageFIeld width

2008-01-08 Thread Rodrigo Culagovski
How can you validate that an ImageField's width is <= a maximum in pixels? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

Re: ImageField: separating text field from button

2008-01-01 Thread Karen Tracey
On Jan 1, 2008 10:30 AM, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > > > can you explain a bit clearly what you want to do? > > If I have a form (newform) with a ImageFiled (probably the same with a > FileField) and in the template I use {{ form }} to display this form, > the text field and

Re: ImageField: separating text field from button

2008-01-01 Thread Przemek Gawronski
> can you explain a bit clearly what you want to do? If I have a form (newform) with a ImageFiled (probably the same with a FileField) and in the template I use {{ form }} to display this form, the text field and the button you press to select a file are right next to each other, and I want some

Re: ImageField: separating text field from button

2008-01-01 Thread Kenneth Gonsalves
On 01-Jan-08, at 6:36 PM, Przemek Gawronski wrote: > Hi, I want to separate the file name text field from 'select' > button in > ImageField from newforms. What would be the cleanest way to do this? can you explain a bit clearly what you want to do? -- regard

ImageField: separating text field from button

2008-01-01 Thread Przemek Gawronski
Hi, I want to separate the file name text field from 'select' button in ImageField from newforms. What would be the cleanest way to do this? Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info: http://tanren.pl/ phone:+4850151 mailto:[EMAIL PROTECTED

Re: ModelForm, ImageField and User

2007-12-28 Thread l5x
On Dec 27, 8:22 am, Muchanic <[EMAIL PROTECTED]> wrote: > Just FYI and for anyone else who comes across this thread - I had the > same problem, trying to pass a ForeignKey via HiddenInput in an app > I'm working on. If you need to/want to do it this way, the trick is > that you have to use a

Re: Having avatar ImageField in UserProfile

2007-12-27 Thread Dmitry Lipovoi
try to get_FIELDNAME_width() and get_FIELDNAME_height() methods of model. On Dec 26, 9:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Ok, > > I was able to get much of the stuff going...There's one main question > I have now > > 1) I have an avatar

Re: ModelForm, ImageField and User

2007-12-26 Thread Muchanic
Just FYI and for anyone else who comes across this thread - I had the same problem, trying to pass a ForeignKey via HiddenInput in an app I'm working on. If you need to/want to do it this way, the trick is that you have to use a ModelChoiceField and not an IntegerField for Django to be able to do

Re: Having avatar ImageField in UserProfile

2007-12-25 Thread [EMAIL PROTECTED]
Ok, I was able to get much of the stuff going...There's one main question I have now 1) I have an avatar field (ImageField type) in my form..and I want to check for a valid size of the avatar image in the clean_avatar(self) method of my form. How can I get access to the uploaded file

Having avatar ImageField in UserProfile

2007-12-25 Thread [EMAIL PROTECTED]
I am new to Django and python overall. The django experience thus far, has been great -- immensely satisfying. The only regret I have is not getting on the django bandwagon earlier. Anyways, as I've been trying to code away, I hit a stumbling block while using the newforms and imagefield

Re: ModelForm, ImageField and User

2007-12-25 Thread l5x
Thank you, I will check that. I wasn't aware of that possibility. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

Re: ModelForm, ImageField and User

2007-12-24 Thread lispingng
i think you should look at using threadlocals to access users outside the request instead of sending the user id in a hidden field. http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser quite straightforward On Dec 24, 2:10 am, l5x <[EMAIL PROTECTED]> wrote: > class Photo(models.Model):

ModelForm, ImageField and User

2007-12-23 Thread l5x
class Photo(models.Model): user = models.ForeignKey(User) main = models.BooleanField(_('Is main?')) icon = models.ImageField(_('Icon'), upload_to='photo', null=True, blank=True, help_text=_('Don\'t touch! It will be generated automatically')) medium =

Re: ImageField and save method

2007-12-10 Thread Julien
Hey, thanks guys, now I understand a little better. One of the articles you're pointing says: "Currently, the only technique you can reliably use is to override _save_FIELD_file on your model. This isn't quite the same as save_FOO_file that's officially documented." I in fact followed the

Re: ImageField and save method

2007-12-10 Thread Marty Alchin
On Dec 10, 2007 7:46 AM, Julien <[EMAIL PROTECTED]> wrote: > In the following example, the "save_avatar_file" method is never > called. However the "_save_FIELD_file" method is called. > It looks a bit dirty to me, and I'd like to get rid of the > "_save_FIELD_file method", to only use a method

Re: ImageField and save method

2007-12-10 Thread Thomas
I think this provides more (partially) detail: http://gulopine.gamemusic.org/2007/11/customizing-filenames-without-patching.html Thomas On Dec 10, 2:01 pm, Julien <[EMAIL PROTECTED]> wrote: > I don't explicitly call it myself. > In fact, the _save_FIELD_file method (not save_avatar_file) is >

Re: ImageField file naming

2007-11-30 Thread Marty Alchin
I don't have a definitive answer at this point, no. Everybody who wants some form of flexible file naming has a different need, and it's tough to come up with something that pleases everyone, while still being a fairly concise API. I've been giving it some thought, and I'll make sure to bring it

Re: ImageField file naming

2007-11-30 Thread Chris Hoeppner
I guess you don't have a hint for me to get this working? It seems like everyone's having that rename issue where _get_pk returns none. I'm just blind-guessing, but perhaps the way to go might be "moving" the file on post_save onto another name, since pre_save doesn't provide a pk value? I don't

Re: ImageField file naming

2007-11-23 Thread Chris Hoeppner
El mar, 20-11-2007 a las 15:41 -0500, Marty Alchin escribió: > On Nov 20, 2007 3:33 PM, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > It would be nice to be able to include this in the upload_to parameter. > > Something like > > 'upload/%(model_name)s/%(instance_id)s.%(mimetype_extension)s'

Re: ImageField file naming

2007-11-20 Thread Marty Alchin
On Nov 20, 2007 3:33 PM, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > It would be nice to be able to include this in the upload_to parameter. > Something like > 'upload/%(model_name)s/%(instance_id)s.%(mimetype_extension)s' perhaps? > Maybe, if the parameter ends with a slash, the handler could

ImageField file naming

2007-11-20 Thread Chris Hoeppner
Hi there! I've seen this in patches and stuff before, but most don't work anymore. Perhaps some Django-insider could advice me how to make Django rename uploaded files according to some schema when saving them to disk? Preserving the original filename is ok for most cases, but sometimes it just

Re: ImageField Validation Error

2007-11-15 Thread Arnold Chen
I faced this problem as well, but there is a work around. I am using django 0.97 pre (i downloaded from svn 16th Nov, 2007) Go to c:/python2.4/lib/site-packages/django/core/validators.py or /usr/lib/python2.4/site-packages/django/core/validators.py , if you are using Fedora comment the

Re: Dynamic ImageField

2007-11-13 Thread Peter
gt; several questions that I kept answering with "it'll be better when my > filestorage work makes it into trunk". I felt it was better to have > something out there in the meantime, and I didn't research what > solutions others had come up with. > > In my opinion, th

Re: Dynamic ImageField

2007-11-13 Thread Marty Alchin
my opinion, the FileField (or ImageField) subclass approach linked by Marcin is much simpler and cleaner than my own, and requires much less ugly hackery. That said, this should all get better when my filestorage work makes it into trunk. ;) -Gul --~--~-~--~~~---~--~~ You rece

Re: Dynamic ImageField

2007-11-13 Thread Peter
Thanks for posting the example links. Is there any documentation on "save_file" and what each field actually is for this method? I was using some random numbers in the folder creation and wanted to make sure the folders exist before I save the file. Also, is there a big reason to override this

Re: ImageField Validation Error

2007-11-12 Thread drackett
I'm running into this exact same issue. Very few images I try are "valid" even though I can work with them in PIL by hand. On Nov 4, 1:27 pm, Matt <[EMAIL PROTECTED]> wrote: > I've got a model with an ImageField. But, when I attempt to add an > image via the Admin interfac

Got IOError at < fp = open(full_filename, 'wb') > when I used ImageField.

2007-11-09 Thread Hu, Zhenghui
I added a ImageField(upload_to = ' ing/media/') into my model. MEDIA_ROOT = '/home/huzhenghui37/ppcat.huzhenghui37.net/' in settings.py. When I used this field in admin through (a file-upload widget), i chose an image ( /home/ huzhenghui37/faceicon.jpg ) and save. Then i got the error

Re: Dynamic ImageField

2007-11-08 Thread cschand
Hi Marcin It's working... Thankyou very much :) cschand On Nov 8, 6:46 pm, Marcin Mierzejewski <[EMAIL PROTECTED]> wrote: > Hi, > > Yes, you > can:http://scottbarnham.com/blog/2007/07/31/uploading-images-to-a-dynamic...http://code.djangoproject.com/wiki/CustomUploadAndFilters > > Regards, >

Re: Dynamic ImageField

2007-11-08 Thread Marcin Mierzejewski
Hi, Yes, you can: http://scottbarnham.com/blog/2007/07/31/uploading-images-to-a-dynamic-path-with-django/ http://code.djangoproject.com/wiki/CustomUploadAndFilters Regards, Marcin On Nov 8, 2:08 pm, cschand <[EMAIL PROTECTED]> wrote: > Hi all, > Can we make dynamic ImageFields? upload file

Dynamic ImageField

2007-11-08 Thread cschand
Hi all, Can we make dynamic ImageFields? upload file to /media/avatar/ username or userid/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Problems with ImageField

2007-11-06 Thread Ramdas S
Remove the fwdslash in front image = models.ImageField(upload_to='toy_images/') It will work On 11/7/07, Stupid Dustbin <[EMAIL PROTECTED]> wrote: > > > Hi, > > recently I decide to try out the ImageField but it gives me some > problems. > > in my models it is

Re: Problems with ImageField

2007-11-06 Thread Kenneth Gonsalves
On 07-Nov-07, at 10:14 AM, Stupid Dustbin wrote: > image = models.ImageField(upload_to='/toy_images/') upload_to='toy_images/' -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message

Problems with ImageField

2007-11-06 Thread Stupid Dustbin
Hi, recently I decide to try out the ImageField but it gives me some problems. in my models it is image = models.ImageField(upload_to='/toy_images/') in my settings.py here are my media settings MEDIA_ROOT = '/media/' MEDIA_URL = MEDIA_URL = 'http://localhost:8000/media

Problems with ImageField

2007-11-06 Thread Stupid Dustbin
Hi, recently I decide to try out the ImageField but it gives me some problems. in my models it is image = models.ImageField(upload_to='/toy_images/') in my settings.py here are my media settings MEDIA_ROOT = '/media/' MEDIA_URL = MEDIA_URL = 'http://localhost:8000/media

ImageField Validation Error

2007-11-04 Thread Matt
I've got a model with an ImageField. But, when I attempt to add an image via the Admin interface, I receive the error message: "Upload a valid image. The file you uploaded was either not an image or a corrupted image." I'm pretty sure that all of my paths are set correctly because I

Re: upload_to dir in ImageField

2007-10-05 Thread Steve Potter
On Oct 5, 6:45 pm, Andy <[EMAIL PROTECTED]> wrote: > I'm having some trouble with the object.get__url() results > for my image field. I'm trying to get this going with the Django's > (ver 0.95) development server in WinXP. I have the following line in > my model: > > avatar =

upload_to dir in ImageField

2007-10-05 Thread Andy
I'm having some trouble with the object.get__url() results for my image field. I'm trying to get this going with the Django's (ver 0.95) development server in WinXP. I have the following line in my model: avatar = models.ImageField(upload_to='users/', blank=True, null=True) I have the

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread daev
On 28, 18:05, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Is there any similar trick or should I modify admin > template for change form? Yes, you have to edit admin page template to do that --~--~-~--~~~---~--~~ You received this message because you are

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread Thomas Badran
Brilliant, thankyou. Tom On Tue, 2007-08-28 at 13:51 +, daev wrote: > Try this: > > image = models.ImageField() > > def image_thumbnail(self): > return "" % > self.get_image_url() > image_thumbnail.allow_tags = True > > class Admin: > list_display = ( "image_thumbnail", ) > > >

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread Jarek Zgoda
On 28 Sie, 15:51, daev <[EMAIL PROTECTED]> wrote: > Try this: > > image = models.ImageField() > > def image_thumbnail(self): > return "" % > self.get_image_url() > image_thumbnail.allow_tags = True > > class Admin: > list_display = ( "image_thumbnail", ) That works fine on objects list

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread daev
Try this: image = models.ImageField() def image_thumbnail(self): return "" % self.get_image_url() image_thumbnail.allow_tags = True class Admin: list_display = ( "image_thumbnail", ) --~--~-~--~~~---~--~~ You received this message because you are

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread Thomas Badran
Oh great suggestion, that file browser actually looks very useful for other purposes as well, i was trying to think of good way of providing 'static' page editing with images etc. and that looks to be a great help there. Thanks Tom On Tue, 2007-08-28 at 06:43 -0700, patrickk wrote: > One way

Re: Thumbnails for ImageField in admin pages

2007-08-28 Thread patrickk
One way is using the FileBrowser: http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki But I guess there are other possibilities (just search this forum ...) Patrick On 28 Aug., 15:35, Thomas Badran <[EMAIL PROTECTED]> wrote: > Is it possible to have thumbnails for images in the admin

Thumbnails for ImageField in admin pages

2007-08-28 Thread Thomas Badran
Is it possible to have thumbnails for images in the admin pages in 0.96 (ive read something that suggests this might be possible in svn)? I keep finding wonderful new tricks like the side by side javascript stuff for many to many fields etc. but cant seem to find a sensible way of doing this.

Re: ImageField via admin

2007-08-22 Thread Carl Karsten
Grigory Fateyev wrote: > Hello Carl Karsten! > On Tue, 21 Aug 2007 10:21:06 -0500 you wrote: > >> Grigory Fateyev wrote: >>> Hello Carl Karsten! >>> On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: >>> > settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > settings.py:MEDIA_URL = '/site_media/'

Re: ImageField via admin

2007-08-22 Thread Grigory Fateyev
Hello Carl Karsten! On Tue, 21 Aug 2007 10:21:06 -0500 you wrote: > > Grigory Fateyev wrote: > > Hello Carl Karsten! > > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > > > >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > >>> settings.py:MEDIA_URL = '/site_media/' > >>> urls.py:

Re: ImageField via admin

2007-08-21 Thread Grigory Fateyev
Hello Carl Karsten! On Tue, 21 Aug 2007 10:21:06 -0500 you wrote: > > Grigory Fateyev wrote: > > Hello Carl Karsten! > > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > > > >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > >>> settings.py:MEDIA_URL = '/site_media/' > >>> urls.py:

Re: ImageField via admin

2007-08-21 Thread Carl Karsten
Grigory Fateyev wrote: > Hello Carl Karsten! > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/' >>> settings.py:MEDIA_URL = '/site_media/' >>> urls.py:(r'^site_media/(?P.*)$', >>> 'django.views.static.serve', {'document_root': >>>

Re: ImageField via admin

2007-08-20 Thread Carl Karsten
Grigory Fateyev wrote: > Hello Carl Karsten! > On Sun, 19 Aug 2007 21:39:31 -0500 you wrote: > >> Grigory Fateyev wrote: >>> Hello! >>> >>> I have simple class with ImageField, but cann't add any object: >>> >>> class Book(models.Model)

Re: ImageField via admin

2007-08-19 Thread Carl Karsten
Grigory Fateyev wrote: > Hello! > > I have simple class with ImageField, but cann't add any object: > > class Book(models.Model): > name = models.CharField(_('Book Title'), maxlength=200) > book_number = models.IntegerField() > image = models.ImageField(upl

ImageField via admin

2007-08-19 Thread Grigory Fateyev
Hello! I have simple class with ImageField, but cann't add any object: class Book(models.Model): name = models.CharField(_('Book Title'), maxlength=200) book_number = models.IntegerField() image = models.ImageField(upload_to='%Y/%m/%d/', core=True

Re: FileField / ImageField problem on update

2007-08-12 Thread Collin Grady
You can't access the old value once you've sent in a new one, unless you query the database again for the old record before you save the new. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

FileField / ImageField problem on update

2007-08-11 Thread Grupo Django
Hi, When I update a register that has a ImageField, the old file is not deleted from the disk, so I have created a custom save method like this: def save( self ): path = self.get_foto_filename() delete_file(path) super(Perfil, self).save() But path is set to the new

About django's ImageField type

2007-07-26 Thread nick feng
Hi All, I found ImageField is hard to understand for me. Anyone can give me a example and some explanation on it? Thanks. ImageField Like FileField, but validates that the uploaded object is a valid image. Has two extra optional arguments, height_field and width_field, which, if set

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

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

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

ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican
( upload_to=(lambda:'images/%s' % gallery.slug), ...,) ... This won't work, because the ImageField constructor wants "upload_to" to be a String and no Funtion. The Problem is, I want a dynamic image storage path, something like MEDIA_ROOT+"images/" wont work with hundrets

can't use database IDs in filenames with ImageField

2007-06-17 Thread craig.ds
I have a model with an image field. I have overridden the default image field behaviour like so: class ImageField(models.ImageField): def get_directory_name(self): longid = str( model_instance_id_number ).zfill(6) directory = longid[0:2] + "/" +

Admin interface, ImageField and models.TABULAR

2007-04-24 Thread Michel Thadeu Sabchuk
Hi guys! I have the following models: class Product(models.Model): data = models.TextField() class Admin: pass class Photo(models.Model): product = models.ForeignKey(Product, edit_inline=models.TABULAR) file = models.ImageField(upload_to='', core=True)

Admin interface, ImageField and models.TABULAR

2007-04-24 Thread Michel Thadeu Sabchuk
Hi guys! I have the following models: class Product(models.Model): data = models.TextField() class Admin: pass class Photo(models.Model): product = models.ForeignKey(Product, edit_inline=models.TABULAR) file = models.ImageField(upload_to='', core=True)

Re: FileField, ImageField silently fail

2007-04-23 Thread andalucien
, andalucien <[EMAIL PROTECTED]> wrote: > Hi, I'm having trouble getting a FileField or ImageField to work. > > The admin interface successfully validates the field, ensures that > it's an image if I use ImageField, etc. It even shows the normal > confirmation message upon a succe

FileField, ImageField silently fail

2007-04-23 Thread andalucien
Hi, I'm having trouble getting a FileField or ImageField to work. The admin interface successfully validates the field, ensures that it's an image if I use ImageField, etc. It even shows the normal confirmation message upon a successful form submission. However, no record appears

Re: Persistance after re-submit for ImageField/FieldField uploads in newforms

2007-04-19 Thread Benjamin Slavin
Of course, the title should read: "Persistance after re-submit for ImageField/FileField uploads in newforms" On 4/19/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > Howdy all, > > I'm putting together an application that's using a file upload in > ne

Persistance after re-submit for ImageField/FieldField uploads in newforms

2007-04-19 Thread Benjamin Slavin
Howdy all, I'm putting together an application that's using a file upload in newforms (the target is images). The problem that I'm having is that, when there's a validation error elsewhere in the form, the image is 'lost' and the user has to re-attach it to resubmit. Because Django clears-out

Re: Be sure filenames are unique in imagefield

2007-03-15 Thread RajeshD
> I think to put the id of the object on the "upload_to" keyword but I > don't know if this is possible. > Is there a way to ensure the filename is unique for that model? Actually, Django already takes care of this for you. It adds underscore(s) to your upload file's name until the filename is

Re: Be sure filenames are unique in imagefield

2007-03-15 Thread Benedict Verheyen
! I have a save function in the model (the model that has the imagefield defined) and when saving the form, i adjust the filename in that save function: i add a timestamp to the image. self.filename = 'icon_%d.jpg' % gettimestamp() The function to get a timestamp: import datetime import time def gett

Be sure filenames are unique in imagefield

2007-03-15 Thread Michel Thadeu Sabchuk
Hi guys, I want to be able to add a images with same filename but I don't want to replace old images when I repeat a name. Suppose I will add a object with an image field and the filename is image.jpg, I want to be able to add another object with another file, but this file is called image.jpg

Re: Where art thou ImageField

2007-03-13 Thread gorans
Thanks, I found http://www.carcosa.net/jason/software/django/stockphoto/ pretty helpful! Goran On Mar 13, 11:48 am, "Jay Parlar" <[EMAIL PROTECTED]> wrote: > You may want to check out the 'stockphoto' app. Even if you don't use > it directly, it might give you ideas. It seems to handle

Re: Where art thou ImageField

2007-03-12 Thread akonsu
the view i think. on a form submission. new forms have save method too. konstantin On Mar 12, 8:46 pm, "gorans" <[EMAIL PROTECTED]> wrote: > Hmm.. I see the point there. > > But where would be the right place to generate the set of thumbs from > the original image? > > On Mar 13, 1:04 am,

Re: Where art thou ImageField

2007-03-12 Thread Jay Parlar
You may want to check out the 'stockphoto' app. Even if you don't use it directly, it might give you ideas. It seems to handle thumbnails quite well. http://www.carcosa.net/jason/software/django/stockphoto/ Jay P. --~--~-~--~~~---~--~~ You received this message

Re: Where art thou ImageField

2007-03-12 Thread gorans
Hmm.. I see the point there. But where would be the right place to generate the set of thumbs from the original image? On Mar 13, 1:04 am, "akonsu" <[EMAIL PROTECTED]> wrote: > hello, > > regarding the last part of your post: i have an unconfirmed suspicion > that data validation should not be

Re: Where art thou ImageField

2007-03-12 Thread akonsu
hello, regarding the last part of your post: i have an unconfirmed suspicion that data validation should not be done in models but in the forms that manipulate data. does anyone know if this is correct? konstantin On Mar 12, 9:56 am, "gorans" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to

Where art thou ImageField

2007-03-12 Thread gorans
Hi, I'm trying to access the value of an image field which is uploaded in the django admin interface - prior to calling the save. I have a model called Photo with three attributes: large, medium and small. Each are ImageFields. I have overwritten the save( ) function in Photo so that I can

Re: change save url of imagefield

2007-03-05 Thread Benedict Verheyen
Jarosław Świerad schreef: > On Monday 05 March 2007 09:42, Benedict Verheyen wrote: >> Hi, >> >> i have a class with an imagefield. >> I'm trying to add the current logged in user to the path where the image >> field is saved. >> image = models.ImageField(up

Re: change save url of imagefield

2007-03-05 Thread Jarosław Świerad
On Monday 05 March 2007 09:42, Benedict Verheyen wrote: > Hi, > > i have a class with an imagefield. > I'm trying to add the current logged in user to the path where the image > field is saved. > image = models.ImageField(upload_to="img/_USER_/icons/", blank=True )

change save url of imagefield

2007-03-05 Thread Benedict Verheyen
Hi, i have a class with an imagefield. I'm trying to add the current logged in user to the path where the image field is saved. image = models.ImageField(upload_to="img/_USER_/icons/", blank=True ) _USER_ is a placeholder for the "real" user. def add_icon(re

ImageField and adding username to the path

2007-02-21 Thread Benedict Verheyen
Hi, in my application, i want to enable the users to upload pics. These pictures are thus linked to the user. I want to reflect that on a filesystem bases by saving the pics in a directory that also has the authenticated user. Getting the authenticated user isn't a problem, customizing the path

ImageField Question

2007-01-22 Thread Rob Slotboom
"Like FileField, but validates that the uploaded object is a valid image. Has two extra optional arguments, height_field and width_field, which, if set, will be auto-populated with the height and width of the image each time a model instance is saved." So I made this model: class

Somewhat awkward ImageField usage

2006-12-14 Thread Andy Dustman
I have this model: class Photo(Model): title = CharField( maxlength = 80, ) description = TextField() photo = ImageField( upload_to = "photos/%Y/%m/%d", height_field = "H", width_field = "W", ) W = Po

Re: ImageField: Unique with number, not underscore?

2006-12-14 Thread [EMAIL PROTECTED]
Hi. Terji7 schrieb: > Oliver Lavery wrote: > > It seems that the most obvious way would be to alter _save_FIELD_file in > > django/db/models/base.py ~ line 335. [...] > > That sounds like a horrible way to me. Rather use the save() method in > the models: The uploaded image file is being saved

<    1   2   3   4   5   6   >