Hi All,
In my application I have a list of students. Each of those students has a
quite a few other models related to them via a foreign key. Eg:
> class Student(models.Model):
> name = models.CharField(max_length=64)
> surname = models.CharField(max_length=64)
> dob = models.DateField()
> # ...
>
> class ContactLog(models.Model):
> student = models.ForeignKey(Student)
> staff = models.ForeignKey(User)
> # ...
On the 'object_details' page for the Student I include a (shortened) list of
ContactLog objects, with a link to a page to add another entry. The issue I
have come up against is that using one of the {{ form }} variants outputs a
drop-down select box to choose the student, which I would like to avoid.
My questions are:
1) Is is possible to get the generic forms to take a parameter like the
'initial' parameter of the ModelForm constructor?
2) If 'yes', can the form output the label as normal, but a text version of
the selected record and a <hidden> field with the Id value?
I can fairly easily write my own create_object and update_object functions
that support this functionality, but I wanted to check before going down that
path that the django built-ins do not already include this. I can't see
anything in the docs and Google doesn't shed any light on it.
I'm using a tarball install of Django 1.0.
Thanks
Darryl
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---