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
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
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'] + "_" +
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/',
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
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
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.
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
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
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
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.
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
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
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
--~--~-~--~~--
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
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/'
>
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 =
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
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
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
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
> 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
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
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
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
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
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
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
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
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
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):
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 =
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
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
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
>
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
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
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'
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
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
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
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
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
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
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
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
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,
>
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
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
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
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
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
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
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
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 =
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
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
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", )
>
>
>
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
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
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
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
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.
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/'
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:
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:
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':
>>>
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)
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
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
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
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
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
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
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
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
(
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
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] + "/" +
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)
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)
, 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
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
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
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
> 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
!
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
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
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
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,
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
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
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
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
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
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 )
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
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
"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
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
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
401 - 500 of 573 matches
Mail list logo