Re: ImageField questions

2009-07-23 Thread Joshua Russo
On Thu, Jul 23, 2009 at 9:31 PM, Rusty Greer wrote: > > how do i create a query on the size of an image? > > for example: > class Image(models.Model): > >image = models.ImageField(upload_to=upload_to('images'), db_index=True) > > > if i try something like: > >for image

Re: Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread djangonoob
> > I'm using django 1.02, Ubuntu 9.04, python 2.6.2 > > > Issue: I am creating a simple application that allows users to upload > > images. > > I'm using the User from django.contrib.auth.models to manage my users. > > For the image class, i have a ForeignKey to the user an

Re: Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread Lakshman Prasad
lass, i have a ForeignKey to the user and a ImageField > to store my images > > My application works perfectly, except that: > when the user uploads images, the images will be linked to the user > himself. > However, on the upload form, i have a option selection box where all > t

Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread djangonoob
I'm using django 1.02, Ubuntu 9.04, python 2.6.2 Issue: I am creating a simple application that allows users to upload images. I'm using the User from django.contrib.auth.models to manage my users. For the image class, i have a ForeignKey to the user and a ImageField to store my images My

Re: edit form not working with imagefield

2009-07-08 Thread geraldcor
Thank you all. This plugin really did the trick http://malsup.com/jquery/form/. One line of code makes it work and you can expand from there. Worked really well. I highly recommend it for form uploads with ajax and jquery. On Jul 7, 3:02 pm, Xiong Chiamiov wrote: > On

Re: edit form not working with imagefield

2009-07-07 Thread Xiong Chiamiov
On Jul 7, 1:22 pm, Adam Jenkins wrote: > I know that Dojo allows one to upload files with Ajax. It uses an iframe as > a work around. >From what I remember from when I was doing something like this a good year ago, using an iframe is the accepted way of uploading files

Re: edit form not working with imagefield

2009-07-07 Thread Adam Jenkins
nts to tackle this one, I can't use the > > > success: portion of the jQuery.ajax() function. It just skips that > > > step. Could this be related to the imagefield not updating? > > > > > My view: > > > def edit_blog(request, blg_id): > > >

Re: edit form not working with imagefield

2009-07-07 Thread geraldcor
ion of the jQuery.ajax() function. It just skips that > > step. Could this be related to the imagefield not updating? > > > My view: > > def edit_blog(request, blg_id): > >        a = Companyblog.objects.get(pk=blg_id) > >        if request.method == 'POST': > >        

Re: edit form not working with imagefield

2009-07-07 Thread Alex Gaynor
can't use the > success: portion of the jQuery.ajax() function. It just skips that > step. Could this be related to the imagefield not updating? > > My view: > def edit_blog(request, blg_id): >a = Companyblog.objects.get(pk=blg_id) >if request.method == 'POST': >

edit form not working with imagefield

2009-07-07 Thread geraldcor
the form, the image field does not change - the table field filepath does not change. Any ideas on this one? As as aside, in case anyone wants to tackle this one, I can't use the success: portion of the jQuery.ajax() function. It just skips that step. Could this be related to the imagefield

Re: Using a dynamically created ImageField filename prior to save?

2009-07-06 Thread Andrew Turner
2009/7/5 Mirat Can Bayrak : > I have another question. You are naming images as hash of random number. > There is a small chance to produce same name i think. It is not good way to > give name ha? The slug field has a unique=True argument, so if the same file name

Re: Using a dynamically created ImageField filename prior to save?

2009-07-05 Thread Mirat Can Bayrak
I have another question. You are naming images as hash of random number. There is a small chance to produce same name i think. It is not good way to give name ha? -- Mirat Can Bayrak --~--~-~--~~~---~--~~ You received this message

Re: FileField/ImageField and the sites framework

2009-07-02 Thread shannon
Sites are on the same box. Really, i'm just trying to make a proof of concept: each site is just a settings file, media directory, and templates directory. They all share a database. i could use a common MEDIA_ROOT, but just didn't want to. Is there a way to have a secondary media location

Re: FileField/ImageField and the sites framework

2009-07-02 Thread Andrew Fong
Need more data here. This ventures from strictly Django into deployment setups. Why exactly can't you just use a common MEDIA_ROOT? Are your sites on different boxes? -- Andrew On Jul 2, 2:19 pm, smcoll wrote: > i have a project running multiple sites.   One of the apps in

FileField/ImageField and the sites framework

2009-07-02 Thread smcoll
i have a project running multiple sites. One of the apps in the project has a model with a FileField and an M2M to `Site`. Since each site has its own MEDIA_ROOT, a model instance saved from SiteA (publishing on both SiteA and SiteB) can only display the file from SiteA, because the file only

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
On Jul 2, 12:29 pm, Andrew Turner wrote: > Talking to myself again, I've changed the save method slightly:- > >     def save(self): >         if not self.slug: >             name = hashlib.sha1(str(random.random())).hexdigest()[:16] >             self._my_filename =

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner <acturne...@gmail.com>: > 2009/7/2 Andrew Turner <acturne...@gmail.com>: >> Would it be possible to define the hashed filename in the save method, >> and then pass it to the upload_to argument of the ImageField? > > In answer to my own quest

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner <acturne...@gmail.com>: > Would it be possible to define the hashed filename in the save method, > and then pass it to the upload_to argument of the ImageField? In answer to my own question, this seems to work:- def get_path(instance, name): ret

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
Would it be possible to define the hashed filename in the save method, and then pass it to the upload_to argument of the ImageField? Thank you for your reply, Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: Using a dynamically created ImageField filename prior to save?

2009-07-01 Thread Rajesh D
> > > This is an issue which, I believe, is related to Ticket #10788 > > (http://code.djangoproject.com/ticket/10788). > > > The following code snippet used to work with Django 1.0.2, but with > > the latest svn version the slug is not being set to the filename > > produced by get_path because,

Re: Using a dynamically created ImageField filename prior to save?

2009-07-01 Thread Andrew Turner
2009/6/30 Andrew Turner : > Hi, > > This is an issue which, I believe, is related to Ticket #10788 > (http://code.djangoproject.com/ticket/10788). > > The following code snippet used to work with Django 1.0.2, but with > the latest svn version the slug is not being set to

Using a dynamically created ImageField filename prior to save?

2009-06-30 Thread Andrew Turner
Hi, This is an issue which, I believe, is related to Ticket #10788 (http://code.djangoproject.com/ticket/10788). The following code snippet used to work with Django 1.0.2, but with the latest svn version the slug is not being set to the filename produced by get_path because, as I understand it,

Re: Prevent ImageField from trying to load the file automatically on model load?

2009-05-28 Thread Andrew Ingram
Fields, but our admin app is > > hosted on one server (which the images are also served from) whilst > > the main web app is served from another. > > > The problem is that when the web app loads a model with an imagefield, > > it automatically tries to find the file locally

Re: Prevent ImageField from trying to load the file automatically on model load?

2009-05-28 Thread Michael
another. > > The problem is that when the web app loads a model with an imagefield, > it automatically tries to find the file locally which obviously > doesn't exist. All I want from the imagefield is the filename/path, > everything else I need from the image file itself is already stored in &

Prevent ImageField from trying to load the file automatically on model load?

2009-05-28 Thread Andrew Ingram
Hi all, Some of our models make use of ImageFields, but our admin app is hosted on one server (which the images are also served from) whilst the main web app is served from another. The problem is that when the web app loads a model with an imagefield, it automatically tries to find the file

ImageField form validation doesn't work.

2009-05-25 Thread [CPR]-AL.exe
Hello. I have a simple form with only ImageField declared in it and I've got the following problem: when I am trying to upload something that is not am image, i get no errors at all. Form.is_valid() returns True. What should I do to validate the imagedata

Re: FormWizard and ImageField - "this field is required" error

2009-05-20 Thread ringemup
UPDATE: I found a workaround, but it's not pretty. Has anyone done this in a more elegant manner? 1) when defining the initial data to pass into the FormWizard (I do this in a view wrapped around the FormWizard): if len(request.FILES): initial.update({'request_files':request.FILES})

FormWizard and ImageField - "this field is required" error

2009-05-20 Thread ringemup
In the last step of my FormWizard, I have an ImageField. I've made sure that the uploaded image is appearing in request.FILES, but I'm still getting a "this field is required" error upon submission. I assume that this problem is related to this ticket: http://code.djangoproject.com/t

Re: Clearing ImageField from django admin

2009-05-08 Thread Alex Gaynor
On Fri, May 8, 2009 at 5:10 PM, Oleg Oltar <oltarase...@gmail.com> wrote: > Didn't find solution yet. So if you can please help me! > > > On Wed, May 6, 2009 at 6:29 PM, Oleg Oltar <oltarase...@gmail.com> wrote: > >> Hi! >> I am using ImageField to add op

Re: Clearing ImageField from django admin

2009-05-08 Thread Oleg Oltar
Didn't find solution yet. So if you can please help me! On Wed, May 6, 2009 at 6:29 PM, Oleg Oltar <oltarase...@gmail.com> wrote: > Hi! > I am using ImageField to add optional images to my articles from admin. > > image2 = models.ImageField(upload_to="upload", blank

Clearing ImageField from django admin

2009-05-06 Thread Oleg Oltar
Hi! I am using ImageField to add optional images to my articles from admin. image2 = models.ImageField(upload_to="upload", blank=True) I added one image from my server to this field Is there a way to remove the image. If i for example decided not to use the image on the article at al

Re: Problem with uploading a ImageField through ModelForm

2009-04-28 Thread phan sarak
please make sure you have corrected like this *setting.py* MEDIA_ROOT = '*site_media*' #make sure your have it already!! and it's your problems also TEMPLATE_DIRS = ( 'templates', ) *models.py* = from django.db import models class

Re: Problem with uploading a ImageField through ModelForm

2009-04-28 Thread Aaron
Hey, this looks like the same problem I had earlier. The gotcha was that I needed enctype="multipart/form-data" in my form tag, like Hope this isn't too late! Aaron On Mar 9, 5:34 am, Marek Wawrzyczek wrote: > Hi, > > I've got the code like this: > > class

Populating an ImageField from an url

2009-04-27 Thread Fabien
Hello, I'm trying to populate an ImageField with the content of an image from it's url. I'm trying with the following code : --- # image_uri is the URL of my image # new_photo.photo is the ImageField field of my new_photo instance current_file = File(urllib.urlopen(image_uri

Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-17 Thread Christian Berg
Hello! The ImageField and FileField URLs are relative to MEDIA_URL It's important to skip the leading slash, and add an slash to the end of the path Attribute. example: image = models.Imagefield(path="images/") In the Template use {{MEDIA_URL}}{{image.url}} On Fri, 17 Apr 2009 08:0

Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-17 Thread SashaN
I'm hitting same problem. It seems to me it is a bug in django. --~--~-~--~~~---~--~~ 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 unsubscribe

ModelForm witn ImageField, how to add file programmatically?

2009-04-15 Thread bashu
Hello, I have a form derived from ModelForm with ImageField inside. How to select file to upload for a generated FileInput field programmatically? Could this be done by passing file object as one of initial values, when I create a form object? ... from = Form(initial={'image.field.name

Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-02 Thread pielgrzym
: > Hi there, > > Before explanation here is the link to problematic > code:http://wklej.org/hash/968a35feef/ > > If one creates a model with imageField and uses it via admin > everything is just fine - model instances have the image field with > correct url: > > photo = Image

Django ImageField url not relative to MEDIA_ROOT

2009-04-02 Thread pielgrzym
Hi there, Before explanation here is the link to problematic code: http://wklej.org/hash/968a35feef/ If one creates a model with imageField and uses it via admin everything is just fine - model instances have the image field with correct url: photo = Image.objects.get(pk=1) photo.image.url

Re: Strange behaviour with ImageField

2009-03-26 Thread Julien Phalip
On Mar 26, 4:42 pm, Michael Strickland wrote: > You should just be able to take out the MEDIA_ROOT portion of your > upload_to path. So instead of: >     upload_to='%s/images/' % settings.MEDIA_ROOT > You would have: >     upload_to='images/' > > That should make it store

Re: Strange behaviour with ImageField

2009-03-25 Thread Michael Strickland
You should just be able to take out the MEDIA_ROOT portion of your upload_to path. So instead of: upload_to='%s/images/' % settings.MEDIA_ROOT You would have: upload_to='images/' That should make it store the relative address and not the absolute address in your database. As for

Strange behaviour with ImageField

2009-03-25 Thread Julien Phalip
Hi, Sorry if my question seems trivial, but I've looked around for an answer and I'm really at loss... I've got a simple model: class Photo(models.Model): image_file = models.ImageField(_('image file'), upload_to='%s/ images/' % settings.MEDIA_ROOT) But when I upload an image via the

Re: ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Oli Warner
Well now I feel like a moron! Not only did I forget to pass through request.FILES, but I needed enctype="multipart/form-data" on my too. Thanks to both of you! /me slaps himself with a hefty dose of RTFM --~--~-~--~~~---~--~~ You received this message because

Re: ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Ayaz Ahmed Khan
On 25-Mar-09, at 5:45 PM, Oli Warner wrote: >if request.method == 'POST': >f = AdminEditForm(request.POST.copy(), instance = company) >if f.is_valid(): Contents of file input fields/objects are stored within request.FILES dict in Django. You need to add request.FILES as an

Re: ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Alex Koshelev
You don't pass request.FILES to form constructor [1] [1]: http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form On Wed, Mar 25, 2009 at 3:45 PM, Oli Warner wrote: > > I'm having a massive headache. I have a Model called companies with >

Filling ImageField/FileField info without using save() for an already created/stored file?

2009-03-25 Thread Lior
In a model, I have a field (ImageField) where I need to "manually" set an already existing file which is also already stored in my upload directory. My problem is that the only way to set this field correctly is by moving the file to a temporary place, as the save() method wants

ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Oli Warner
I'm having a massive headache. I have a Model called companies with vaious fields but for one form, I want the user to be able to edit two ImageFields and a TextField. "Simple", I thought and quickly made a ModelForm class: class AdminEditForm(ModelForm): class Meta: model = Company

Re: Upload an ImageField from the Python shell

2009-03-24 Thread Matías Costa
On Tue, Mar 24, 2009 at 4:10 PM, Rit <rit@gmail.com> wrote: > > How can I set an ImageField of a model from within the Python shell? > > > ImageField and FileField are just strings. They get special treatment in forms, OK, but your model instance attri

Upload an ImageField from the Python shell

2009-03-24 Thread Rit
How can I set an ImageField of a model from within the Python shell? --~--~-~--~~~---~--~~ 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@google

Re: hashed file name on ImageField

2009-03-19 Thread Chris Van Horne
Seems I found a way around this by overriding the 'save' method on the model which has the ImageField. On Mar 19, 1:11 pm, Chris Van Horne <chris.vanho...@gmail.com> wrote: > Hello, > > I am looking to modify ImageField so that the filename saved to disk > is a hashed (sha1

hashed file name on ImageField

2009-03-19 Thread Chris Van Horne
Hello, I am looking to modify ImageField so that the filename saved to disk is a hashed (sha1 or md5) digest. I have looked at the documentation and it seemed to point me towards subclassing django.core.files.storage.Storage but I haven't had any luck--worse, I'm not sure if this is the "co

Re: problem uploading favicon.ico to an ImageField field

2009-03-10 Thread Michael Repucci
t a strange bug, which seems to be a problem/conflict between PIL > (Python Imaging Library) and the ImageField model field. I have a > standard ImageField, but when a user tries to upload an ico file > (created either athttp://www.html-kit.com/favicon/orhttp://www.favicon.cc/), > django crash

problem uploading favicon.ico to an ImageField field

2009-03-10 Thread Michael Repucci
Hi Django'ers, I get a strange bug, which seems to be a problem/conflict between PIL (Python Imaging Library) and the ImageField model field. I have a standard ImageField, but when a user tries to upload an ico file (created either at http://www.html-kit.com/favicon/ or http://www.favicon.cc

Re: Problem with uploading a ImageField through ModelForm

2009-03-09 Thread Marek Wawrzyczek
Malcolm Tredinnick wrote: > On Mon, 2009-03-09 at 13:34 +0100, Marek Wawrzyczek wrote: > [..] > > >> When I try to use FileField it works the same. How can I slove this >> problem ? >> > > You need to add a bit extra to the HTML form when file uploads are > involved. Essentially, telling

Re: Problem with uploading a ImageField through ModelForm

2009-03-09 Thread Malcolm Tredinnick
On Mon, 2009-03-09 at 13:34 +0100, Marek Wawrzyczek wrote: [..] > When I try to use FileField it works the same. How can I slove this > problem ? You need to add a bit extra to the HTML form when file uploads are involved. Essentially, telling the browser that the response should be encoded

Problem with uploading a ImageField through ModelForm

2009-03-09 Thread Marek Wawrzyczek
Hi, I've got the code like this: class Photo(models.Model): image = models.ImageField(upload_to='photos') class PhotoForm(ModelForm): class Meta: model = Photo View function fragment: if request.method == 'POST': post = request.POST.copy() print 'post:

Re: Does Django get the height/width data of ImageField from height_field?

2009-03-05 Thread Rajesh D
On Mar 5, 1:17 am, liangent <liang...@gmail.com> wrote: > I created a ImageField img_field with height_field parameter in a > model, > added an image, then get it from database. > > If I try to access obj.img_field.height and obj.img_field.width, > where do django get th

Re: Does Django get the height/width data of ImageField from height_field?

2009-03-05 Thread Malcolm Tredinnick
On Wed, 2009-03-04 at 22:17 -0800, liangent wrote: > I created a ImageField img_field with height_field parameter in a > model, > added an image, then get it from database. > > If I try to access obj.img_field.height and obj.img_field.width, > where do django get this data from

Does Django get the height/width data of ImageField from height_field?

2009-03-05 Thread liangent
I created a ImageField img_field with height_field parameter in a model, added an image, then get it from database. If I try to access obj.img_field.height and obj.img_field.width, where do django get this data from? Cached data when SELECTed from db? Or get size with PIL then cache it? Thanks

modelform bound to an instance - imagefield issues

2009-03-03 Thread uno...@gmail.com
I have a model which has an imagefield. I have a modelform which uses this model and in case of editing, uses the instance to populate the form fields. While the other fields (like charfield, textfield etc.) get populated with the instance values correctly, is there any way I can show

Re: Django not deleting files still referenced by ImageField

2009-03-02 Thread Karen Tracey
On Mon, Mar 2, 2009 at 4:47 PM, James <ja...@icionline.ca> wrote: > > So I added a custom storage class to an ImageField which overwrites > files with the same name. > > I noticed while testing that I can add many records all referencing > the same single image, which ge

Re: Django not deleting files still referenced by ImageField

2009-03-02 Thread Alex Gaynor
On Mon, Mar 2, 2009 at 4:47 PM, James <ja...@icionline.ca> wrote: > > So I added a custom storage class to an ImageField which overwrites > files with the same name. > > I noticed while testing that I can add many records all referencing > the same single image, which ge

Django not deleting files still referenced by ImageField

2009-03-02 Thread James
So I added a custom storage class to an ImageField which overwrites files with the same name. I noticed while testing that I can add many records all referencing the same single image, which gets overwritten with each new record created. What's strange/interesting is... the image file doesn't

Re: ImageField causing error when rendering with "The Image" attribute has no file associated with it.

2009-02-23 Thread Karen Tracey
On Thu, Feb 19, 2009 at 7:30 AM, mermer wrote: > > Since I've upgraded to Django ver 1.00, I'm suddenly getting the > following error with my ImageFields. > > The tag is {{ model.image.url}} and it throws an error if the image > field in the database is null (even if it

Re: ImageField causing error when rendering with "The Image" attribute has no file associated with it.

2009-02-23 Thread mermer
Anybody with any advice on this. Ever since wev'e upgraded to version 1.00 we are having issues with the ImageField ValueError: The 'image' attribute has no file associated with it. On 19 Feb, 12:30, mermer <merme...@googlemail.com> wrote: > Since I've upgraded to Django ver 1

ImageField causing error when rendering with "The Image" attribute has no file associated with it.

2009-02-19 Thread mermer
Since I've upgraded to Django ver 1.00, I'm suddenly getting the following error with my ImageFields. The tag is {{ model.image.url}} and it throws an error if the image field in the database is null (even if it is set to null in the model) Am I missing something? Here is the error message

Re: Changing an ImageField file without re-upload

2009-02-16 Thread Eric Abrahamsen
On Feb 17, 2009, at 5:17 AM, Carmelly wrote: > > My situation is this: I want to allow my users to upload multiple > userpics and then choose between them. So I have a Profile model with > an ImageField for the userpic. When users upload a file it is > displayed around the site

Re: Changing an ImageField file without re-upload

2009-02-16 Thread James Mowery
to allow my users to upload multiple > userpics and then choose between them. So I have a Profile model with > an ImageField for the userpic. When users upload a file it is > displayed around the site as usual. When they upload a new file, that > file replaces their the "userp

Changing an ImageField file without re-upload

2009-02-16 Thread Carmelly
My situation is this: I want to allow my users to upload multiple userpics and then choose between them. So I have a Profile model with an ImageField for the userpic. When users upload a file it is displayed around the site as usual. When they upload a new file, that file replaces

Re: need help validating imagefield in modelform..

2009-02-14 Thread Briel
True, > null=True) > > form: > > class AvatarForm(ModelForm): > >         class Meta: >                 model = Avatar > > #1 > >         def clean(self,data,initial=None): >                 content = super(ImageField, self).clean(self,data,initial) >  

need help validating imagefield in modelform..

2009-02-14 Thread PeteDK
model = Avatar #1 def clean(self,data,initial=None): content = super(ImageField, self).clean(self,data,initial) content_type = content.content_type.split('/')[0] if content_type in settings.CONTENT_TYPES:

using the ImageField with the API

2009-02-09 Thread redmonkey
Hey everyone, I've got an interesting problem concerning file uploads. I'm building an online auction and my `Lot` links to a thin `LotImage` so that I can store multiple images of the lots: class Lot(models.Model): ... lot_number = models.PositiveIntegerField("Lot number")

Re: ImageField, width_field, height_field not working

2009-02-04 Thread alex.gay...@gmail.com
On Feb 4, 3:48 pm, vicvicvic wrote: > Hello! > > I have created a ticket for this issue, with a patch which solves it. > I don't think it breaks anything... > > http://code.djangoproject.com/ticket/10196 That patch does indeed look to be correct, if you haven't

Re: ImageField, width_field, height_field not working

2009-02-04 Thread vicvicvic
Hello! I have created a ticket for this issue, with a patch which solves it. I don't think it breaks anything... http://code.djangoproject.com/ticket/10196 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: ImageField, width_field, height_field not working

2009-02-03 Thread A Melé
It seems that after rev. 9766 ImageFieldFile's save() method (where it sets values for height_field and width_field) is bypassed when saving the file (at least with the admin). I use FieldFiles that inherit from ImageFieldFile (for example in django-thumbs code (thanks for reporting the issue,

Re: Django imagefield at development server

2009-01-27 Thread Akhmat Safrudin
felix wrote: > > on my dev server (laptop) I serve the MEDIA_ROOT through the normal > apache localhost. > I do not get django to serve them. > ok, thank's for your attention, the problem is solved, i don't know how it solved, but with deleting table from database, than create it again with

Re: Django imagefield at development server

2009-01-27 Thread felix
on my dev server (laptop) I serve the MEDIA_ROOT through the normal apache localhost. I do not get django to serve them. ie I do not do this at all: urlpatterns += patterns('', (r'^site-media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )

Re: Django imagefield at development server

2009-01-27 Thread Akhmat Safrudin
felix wrote: > no problem uploading using the dev server > > no idea. you didn't leave a pdb in your code, did you ? > > what is the output if any in the shell ? i point the url in the browser to http://localhost:8000/admin/ how to debug with pdb in admin area ? somat. -- Stay Hungry Stay

Re: Django imagefield at development server

2009-01-27 Thread Akhmat Safrudin
phoebebright wrote: > You might also check, > You have DEBUG = True in settings.py > And have permissions set on the photo directory > And have something in urls.py file to point to the photo directory 0. DEBUG was true, 1. to ensure directory is writable, its set to 777, 3. is it some think like

Re: Django imagefield at development server

2009-01-27 Thread phoebebright
i just starting a project, then create app and add some models, > in the model there is an ImageField, > at the admin area i can't insert record, the browser status is "waiting for > localhost" > is django development server can upload file/image ? > i have completely read mode

Re: Django imagefield at development server

2009-01-27 Thread felix
starting a project, then create app and add some models, > in the model there is an ImageField, > at the admin area i can't insert record, the browser status is "waiting for > localhost" > is django development server can upload file/image ? > i have completely read model documentatio

Django imagefield at development server

2009-01-27 Thread Akhmat Safrudin
dear list, i am a noob, i just starting a project, then create app and add some models, in the model there is an ImageField, at the admin area i can't insert record, the browser status is "waiting for localhost" is django development server can upload file/image ? i have completely

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
Malcolm Tredinnick wrote: > So the next thing is to narrow down which commit. You know a good commit > and you know a bad one. Now pick something halfway in between and try > that. Continue with binary searching. It won't take many repetitions to > get to the precise commit. > > Regards, >

Re: ImageField image upload problems

2009-01-23 Thread Malcolm Tredinnick
On Fri, 2009-01-23 at 15:47 -0800, Foxpl wrote: > Hi, i have errors while i am trying to upload image by an admin panel. > > Here is my image model: > > class Photo(models.Model): > Title = models.CharField(max_length=256) > Description = models.TextField(max_length=1024, blank=True) >

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Malcolm Tredinnick
On Fri, 2009-01-23 at 15:19 -0800, Andrew Ingram wrote: > I reverted Django to revision 9756 (just after aggregation was merged > in) and everyone works fine, so evidently a commit made in the last > few days has caused this issue. So the next thing is to narrow down which commit. You know a

ImageField image upload problems

2009-01-23 Thread Foxpl
Hi, i have errors while i am trying to upload image by an admin panel. Here is my image model: class Photo(models.Model): Title = models.CharField(max_length=256) Description = models.TextField(max_length=1024, blank=True) User = models.ForeignKey(User) File =

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
I reverted Django to revision 9756 (just after aggregation was merged in) and everyone works fine, so evidently a commit made in the last few days has caused this issue. Regards, Andrew Ingram On Jan 23, 6:40 pm, Andrew Ingram wrote: > I've just tried saving the model

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
I've just tried saving the model using the approach followed in Django's unit test and the database gets populated correctly, this reinforces the likelihood of it being an admin-related issue. Regards, Andrew Ingram, Karen Tracey wrote: > http://code.djangoproject.com/ticket/9545 > > also

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
Thanks for your response Karen, I've tried the workaround in the ticket and I get this error: Exception Type: AttributeError Exception Value: 'InMemoryUploadedFile' object has no attribute 'width' I have a vague recollection that this was actually working before I did the

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Karen Tracey
On Fri, Jan 23, 2009 at 6:55 AM, Andrew Ingram <a...@andrewingram.net>wrote: > > Hi > > I am trying to use the height_field and width_field arguments for > ImageField to auto-populate the dimension of images to other fields, but > it doesn't seem to be working. >

ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
Hi I am trying to use the height_field and width_field arguments for ImageField to auto-populate the dimension of images to other fields, but it doesn't seem to be working. I've duplicated the usage that's in Django's test suite (which incidentally is the only mention I can find that you

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Yes avatar.image.url works, thanks again. -Aaron On Mon, Jan 19, 2009 at 5:17 PM, creecode wrote: > > I think you may be correct on that my tip was incorrect. Forget what > I said! :-) > > Have you tried getting the url like avatar.image.url? I use a line > like this in

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
I think you may be correct on that my tip was incorrect. Forget what I said! :-) Have you tried getting the url like avatar.image.url? I use a line like this in some of my code that uses S3Storage and it works. image_url = my_model_instance.image.url.replace ( ':80', '' ) On Jan 19, 4:01 pm,

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread David Larlet
Le 20 janv. 09 à 01:48, Aaron Lee a écrit : > Thanks David, but it seems awkward to call > > avatar.image.storage.url(str(avatar.image)) > > to retrieve the URL for an ImageField. > Do you have a better way? avatar.image.url should work (without parenthesis, that's a pr

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Thanks David, but it seems awkward to call avatar.image.storage.url(str(avatar.image)) to retrieve the URL for an ImageField. Do you have a better way? -Aaron On Mon, Jan 19, 2009 at 4:02 PM, David Larlet <lar...@gmail.com> wrote: > > > Le 19 janv. 09 à 22:53, Aa

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread David Larlet
Le 19 janv. 09 à 22:53, Aaron Lee a écrit : > > But I am still getting the exception saying the backend doesn't > support absolute paths. > In django/db/models/fields/files.py line 52 _get_path > return self.storage.path(self.name) > > and my self.name is userprofile/cs1.jpg > > Any

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
Hey Aaron, I think part of your problem is that AWS_STORAGE_BUCKET_NAME is not properly specified. It think it needs to be something like my-bucket- name.s3.amazonaws.com. Based on your settings then you should find your images end up at http:my-bucket-name.s3.amazonaws.com/ userprofile/. You

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Merrick <merr...@gmail.com> wrote: > > I am using S3Storage with an imagefield successfully. It sounds like > you have not specified the storage engine and keys etc... in > settings.py as creecode pointed out. > > I recall testing that the directory will be created on the fly if i

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Merrick
I am using S3Storage with an imagefield successfully. It sounds like you have not specified the storage engine and keys etc... in settings.py as creecode pointed out. I recall testing that the directory will be created on the fly if it does not exist. On Jan 19, 12:40 pm, creecode <cr

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
ESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_STORAGE_BUCKET_NAME AWS_CALLING_FORMAT Have you installed any software S3Storage depends on? On Jan 19, 8:02 am, "Aaron Lee" <waifun...@gmail.com> wrote: > So I guess S3Storage doesn't work with ImageField? Can anyone confirm that? Toodle-lo

<    1   2   3   4   5   6   >