Formset and Choices with Objects
I'm trying to use a formset to display a variable number of detail rows on a form. It's what they were created for, right? However, in order to display more detail in each row, I'd like to have access to the object behind it - to reference columns not displayed, follow foreign key relationships, etc., but I can't see how to do it. Any advice? On the same form, I'd like a similar functionality for the choices in a series of radio buttons. The choices attribute only accepts a list of two values - index and label. The design calls for several pieces of data (date, time, location) and the radio button in a tabular format. Any thoughts here? Thanks for pondering my questions. Dan Gentry -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Formset and Choices with Objects
I should have included that my desire is to access these objects in the template. On Apr 21, 11:22 am, Dan Gentry wrote: > I'm trying to use a formset to display a variable number of detail > rows on a form. It's what they were created for, right? > > However, in order to display more detail in each row, I'd like to have > access to the object behind it - to reference columns not displayed, > follow foreign key relationships, etc., but I can't see how to do it. > Any advice? > > On the same form, I'd like a similar functionality for the choices in > a series of radio buttons. The choices attribute only accepts a list > of two values - index and label. The design calls for several pieces > of data (date, time, location) and the radio button in a tabular > format. Any thoughts here? > > Thanks for pondering my questions. > > Dan Gentry -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Formset and Choices with Objects
For the first question, you can use the form's 'instance' property to access the underlying model instance. For the latter, it sounds like you just need to concatenate the stuff you display. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.