I want to create an edit form for Organization, but I'm struggling with how best to save (and re-retrieve for display) the descr field in OrganizationItem. I don't see how adding fields to the OrganizationForm will accomplish this.
class ListItem(models.Model):
-- # Models
class Organization(models.Model):
name = models.CharField("Organization's name", max_length=100)
items = models.ManyToManyField(ListItem, through='OrganizationItem')
class OrganizationItem(models.Model):
organization = models.ForeignKey(Organization)
item = models.ForeignKey(ListItem)
descr = models.TextField("Description", blank=True)
class ListItem(models.Model):
name = models.CharField("Name", max_length=200)
order = models.IntegerField("Order")
extraInfo = models.BooleanField("Requires extra information")
multiLineInfo = models.BooleanField("The display should use a multi-line edit box instead of a single line edit")
descrLabel = models.CharField("Extra information label", max_length=50,
blank=True)
# ModelForm
class OrganizationForm(ModelForm):
class Meta:
model = Organization
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/i4f72wAdJqkJ.
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