For this case inline-formsets should be the way to go: 
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets
But I think this will work for a particular person, but not for multiple 
persons...

Am Freitag, 18. Mai 2012 15:27:05 UTC+2 schrieb David:
>
> Given 2 models:
>
> class Person(models.Model):
>     first_name = models.CharField(max_length=255)
>     last_name = models.CharField(max_length=255)
>
> class PersonAttendance(models.Model):
>     person = models.ForeignKey(Person)
>     attend_date = models.DateField()
>
> I need to produce a formset that lists all Person(s) and their 
> PersonAttendance if it has been entered, and blank fields for Persons that 
> have no PersonAttendance related record so their attendance can be filled 
> in.
>
> In SQL I guess this would be achieved using a LEFT JOIN on Person, but I 
> can't work out how to get this working with the ORM and Django Formsets.
>
> Any help would be greatly appreciated, I've been stumped on this for ages.
>
> Thank you
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/aZuOiHNhGcEJ.
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.

Reply via email to