Ok, thanks, but I want to be able to add QMs to trips when creating
new trips. Is that possible in the admin interface? Or should I be
using a form?

On Jul 12, 1:35 am, J Meier <[EMAIL PROTECTED]> wrote:
> I might try setting up Trip without direct reference to the QMs, and
> QMs with two references to Trip:
>
> class Trip(models.Model):
>    ... trip stuff ...
>
> class QM(models.Model):
>     found_during = models.ForeignKey(Trip, related_name=''found_qms")
>     killed_during = models.ForeignKey(Trip, null=True, blank=True,
> related_name="killed_qms")
>     ... trip stuff ...
>
> and maybe a few convenience methods and properties:
>
> (in Trip):
> @property
> def live_qms(self): return self.found_qms.filter(killed_during=None)
>
> (in QM:)
> @property
> def status(self): return self.killed_during == None and "Live" or
> "Dead"
>
> -Jim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to