Hi everyone,

I have the following situation, and I would value advice.

I have two classes, FolderUpload and FileUpload as given below. I want
a dynamic upload_to url in FileUpload, such that the upload to field
depends on the value of the folder field, specifically path field. I
realist that currently some workaround is necessary, since Django does
not yet support dynamic upload_to fields. I found the description of
some workarounds, but could not get any of them to work in the
described scenario. I'm hoping that someone will have dealt with a
similar situation, and will have some ideas.

Please cc me by email on any response.
                                                        Thanks, Faheem.

*********************************************************************************************************
class FolderUpload(models.Model):
     upload_date = models.DateTimeField(auto_now_add=True)
     name = models.CharField(core=True, maxlength=100)
     description = models.CharField(blank=True, maxlength=200)
     parent_folder = models.ForeignKey('self', null=True, blank=True, 
related_name='subfolders')
     path = models.FilePathField(path='', editable=False)

class FileUpload(models.Model):
     upload_date = models.DateTimeField(default=datetime.now(), blank=True, 
editable=False)
     upload = models.FileField(upload_to=settings.BIXFILE_MEDIA)
     name = models.CharField(core=True, maxlength=100)
     description = models.CharField(blank=True, maxlength=200)
     folder = models.ForeignKey(FolderUpload, null=True, blank=True, 
related_name='parentfolder', edit_inline=models.TABULAR)
**********************************************************************************************************

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to