I would like to do the following:

class WSMRTask(GridTask):
    tasktype        = "wsmr"
    mtz_fp          = FileField("MTZ file", upload_to=WSMRTask.path_gen)

class GridTask(Model):
    tasktype        = "unspec"
    def path_gen(instance, filename):
        return "%s/%s" % (WSMR_RELPATH, self.tasktype, self.taskname, 
self.filename)

since the properties to generate the upload_to pathname+filename come from 
the model instance itself.  I can't do this since the WSMRTask isn't defined 
at the point when I reference it (inside the class def).  Any good 
suggestions about how I can do this *other* than the obvious option of 
creating a separate module of functions that support the specific class?  
That is *so* not OO, but I'll do it if it is the only option.

Ian

-- 
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 from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to