Probably the title is not very accurate, but I did not know how to word
it any better! Probably the following scenarios will make it clearer:

1. I would like to generate the 'upload_to' parameter of the FileField
based on the value of another field in my model.

example:

===
class File(models.Model):
    title = models.CharField(maxlength=50)
    project = models.ForeignKey(Project)
    document = models.FileField(upload_to='files/' + self.title +
'/',blank=True,null=True)
===


2. I would like to use some value from my instance to create the Q
object passed to the 'limit_choices_to' parameter.

example:

===
class File(models.Model):
    title = models.CharField(maxlength=50)
    project = models.ForeignKey(Project)
    supercedes =
models.ForeignKey('self',limit_choices_to=Q(project=self.project,blank=True,null=True)
===

Is there any way to do that? It seems to me that having an "automatic"
self variable that will be mapped to the instance would solve this
problem... any thoughts?

Thanks!


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

Reply via email to