I have  a model like

class File(models.Model):
  file = models.FileField(upload_to = 'files')
  project = models.ForeignKey(Project)

class Project(models.Model):
  name = models.CharField(max_length = 100)

I want to have each file go a specific directory corresponding to its
project_name
So I want to do something like,

class File(models.Model):
  file = models.FileField(upload_to = project.name)
  project = models.ForeignKey(Project)

But of course this won work, as until the metaclass magic happens and
I have an object project dos not have the name attribute. So how can I
achieve this.

--~--~---------~--~----~------------~-------~--~----~
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