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 for a given field (in
> this case, "save_avatar_file").
>
> Do you know why it's not working as expected?

Believe it or not, this is working as expected. At least, to those of
us who know what to expect. When your model is read in by Python,
Django automatically creates a new save_avatar_file() and attaches it
to your model, which will override any such method you define. It's
not pretty, but it's how it works.

As with many FileField-related issues, this behavior will be changing
once I get my rewrite finished, which should be fairly soon. I'm still
working out a few backward-compatibility issues, but it's nearly
ready. Once it gets committed to trunk, I'll do a full writeup on how
to accomplish things like what you're trying to do.

Until then, take a look at Scott Barnham's article[1] about renaming
files in a way that should work for you.

-Gul

[1] 
http://scottbarnham.com/blog/2007/07/31/uploading-images-to-a-dynamic-path-with-django/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to