You can use YourModel._meta.fields to dynamically generate a list of checkboxes for each field to choose from. In your view, you can use that list to dynamically only SELECT those fields from the database (this step is not necessary, but it provides some extra performance for cases where only a few fields are selected) and in the template, I believe, you can use that same list to only display the selected fields. Something like that should work:
http://dpaste.com/hold/72370/ Regards, Erik Allik On 19.08.2008, at 12:55, laspal wrote: > > hi, > My modes is : > class Company(models.Model): > name = models.CharField( maxlength=100) > met_by = models.CharField(null=True, maxlength=200) > primary_contact = models.IntegerField(null=True, blank=True) > business_overview = models.TextField(null=True, maxlength = 2000 ) > transaction_oppurtunity = models.TextField(null=True, maxlength = > 2000) > currency_unit = models.CharField( null=True,maxlength = 10) > financial_unit = models.CharField( null=True, maxlength = 10) > country = models.CharField(null=True, maxlength=2) > notes = models.ManyToManyField(Notes, related_name="companies") > contacts = models.ManyToManyField(Contact, > related_name="companies") > created_on = models.DateTimeField(auto_now_add=True) > updated_on = models.DateTimeField( auto_now = True) > > > So I am displaying companies in tabular format. > So my problem is user want a form to be displayed first before > listing. So the form will contains > a checkbox with all the field names. > After submitting the form user is able to see companies in tabular > format with the fields he has choose > from the checkbox. > > So I wanted to know how can I handle this situations. > I mean should I create a model for this or just add a form to it and > how will I pass the information from the form to the listing companies > views?? > > 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?hl=en -~----------~----~----~----~------~----~------~--~---