Re: How does django convert string to modules

2010-09-10 Thread Bachir
What if was gibing a string like this: 'math.ceil', and i had to import the function(not the module) dynamically(from the string), how can i do that? import_module is for importing... modules, not functions. 2010/9/10 Bachir > thanks, éthat's really an awesome explanation. th

Re: How does django convert string to modules

2010-09-10 Thread Bachir
thanks, éthat's really an awesome explanation. thanks 2010/9/10 Tom Evans > On Fri, Sep 10, 2010 at 1:05 AM, Bachir wrote: > > The problem is not the lack of information, the real problem is that i > don't > > know what to search for . > > > > 2010/9/9

Re: How does django convert string to modules

2010-09-09 Thread Bachir
The problem is not the lack of information, the real problem is that i don't know what to search for . 2010/9/9 bruno desthuilliers > > > On 9 sep, 03:46, maroxe wrote: > > Hi, I am trying to understand an other magic thing about django: it > > can convert strings to modules. In settings.py, IN

Re: django not taking in consideration model fields declared in __init__

2010-09-08 Thread Bachir
cheers :D 2010/9/8 akaariai > On 8 syys, 19:26, Bachir wrote: > > This is an example: > > > > class UploadItem(models.Model): > > file = models.FileField(upload_to=UploadItem.get_directory) > > > > class Meta: > > abstract =

Re: django not taking in consideration model fields declared in __init__

2010-09-08 Thread Bachir
This is an example: class UploadItem(models.Model): file = models.FileField(upload_to=UploadItem.get_directory) class Meta: abstract = True # I want videos to be storred in 'videos/' directory class Video(UploadItem): def get_directory(self, instance, filename): retur

Re: django not taking in consideration model fields declared in __init__

2010-09-08 Thread Bachir
OK, i got that. Now my problem: I have an abstract class UploadItem that defines a field called file like this: self.file = models.FileField(upload_to=upload_to) As you can see, in each child class, i have to call parent init method with appropriate upload_to variable(say 'videos' for Video model).