Found a really tidy way of doing this.

Created a new css style based on the Django Wide and Collapse styles
calld Hide

/* CUSTOM TYPE hide  */
.hide label { width:15em !important; }
.colM .hide select { visibility: hidden; }
fieldset.hide * { display:none; }

Then in the model simply grouped together the fields I wanted to hide
and applied the Hide class to that fieldset

class Question(meta.Model):
  fields = (
        meta.ForeignKey(Student),
        meta.ForeignKey(Group),
        meta.ForeignKey(QuestionType),
        meta.CharField('question', maxlength=250),
  )

  admin = meta.Admin(save_as=True,
        fields = (
           (None, {'fields': ('question', 'questiontype_id')}),
           ('Hidden Info', {'fields': ('student_id', 'group_id', ),
'classes': 'hide'}),
        ),

  )





[EMAIL PROTECTED] wrote:
> Hi
>
> I want to be able to pass the values of certain form fields to the form
> and have them rendered as read only or hidden fields.
> 
> Is there an elegant way of doing this?
> 
> Thanks
> Charlotte

Reply via email to