Hi all,
I am trying to display a formset in my application such that it only
contains number of forms equal to number of database instances.

My models are as below:
class Card(models.Model):
  name = models.CharField(max_length=20, blank=False, null=False,
unique=True)
   def __str__(self):
    return self.name + " Card"

class CardRow(models.Model):
  card = models.ForeignKey(ContactCard, related_name='data')

  name = models.CharField(max_length=22, blank=False, null=False)
  phone1 = models.CharField(max_length=20, blank=True)
  relation=models.CharField(max_length=30, blank=True)
  location=models.CharField(max_length=30, blank=True)

My forms are:
class CardForm(forms.ModelForm):
  class Meta:
    model = Card

class CardRowForm(forms.ModelForm):
  class Meta:
    model = CardRow
    exclude = ('card',)

CardRowFormSet = inlineformset_factory(Card, CardRow,max_num=10,
extra=10)

I want in the formset, the number of forms to be equal to number of
rows per card.
I have tried many combinations for max_num and extra fields, but in
vain.

Can somebody throw light on this issue??

Thanks in advance,
Sonal


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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