Saturday, February 25, 2012

inlineformset_factory and predefined fields

I have something like this

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

class ProjectFileType(models.Model):
name = models.FileField()
required = models.BooleanField()

class ProjectFile(models.Model):
my_file = models.FileField()
project = models.ForeignKey(Project)
file_type = models.ForeignKey(ProjectFileType)


When creating a new project I want to use formset to upload the files.
The trick is that I want to show fields only for the required file
types. So the types in the formset should be set on init and read
only.

Any ideas how to do 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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment