(not a movie trivia problem!)
The question I need to resolve here is "does Passenger 57 qualify for a
discount"?
Given the following models:
class Alliance(models.Model):
name = models.CharField(max_length=100)
#e.g. Star, Western, Pacific, European
discount = models.FloatField()
class Airline(models.Model):
name = models.CharField(max_length=100)
#e.g. AIA, Northwest, Cathay, KLM
membership = models.ManyToManyField(Alliance)
class Flight(models.Model):
name = models.CharField(max_length=100)
operator = models.ForeignKey(Airline)
class Passenger(models.Model):
name = models.CharField(max_length=100)
flight = models.ForeignKey(Flight)
memberships = models.ManyToManyField(Alliance)
So, if Passenger 57 books a flight with, say, AIA, which is a member of the
Star and Western alliances, how can I tell if this qualifies for a
discount? Assume, for purpose of this query, that the logged in user_id is
the same as the passenger_id (i.e. 57).
--
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.