Re: Custom upload field - app and model name from field

2006-07-28 Thread Enrico
Thanks Chris. I was trying to access the _meta in the __init__ method and it didn't worked because I didn't have an instance. Then I used a post_init method to set up my custom "upload_to". Now I don't have to worry about where to put my uploads! That's nice! :) Regards. Enrico --~--~---

Custom upload field - app and model name from field

2006-07-28 Thread Enrico
Hi, I'm trying to make a custom upload field that generate the "upload_to" option automatically, based on the app, model and field names and the primary key. For example, having an app 'Album' with a model 'Picture' with a field 'pic' as the upload field, the path should be: album/picture/pic/1.

Re: Custom upload field - app and model name from field

2006-07-28 Thread [EMAIL PROTECTED]
You can get the application and model name from the object by doing To get app name: obj._meta.app_label To get model name(I think, I've never tried this): obj._meta.module_name Chris --~--~-~--~~~---~--~~ You received this message because you are subscribe