On Feb 16, 4:50 pm, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On Feb 16, 4:54 pm, Emily Rodgers <emily.kate.rodg...@googlemail.com> > wrote: > > > > > On Feb 16, 3:39 pm, bruno desthuilliers > > > <bruno.desthuilli...@gmail.com> wrote: > > > On Feb 16, 2:56 pm, Derek <gamesb...@gmail.com> wrote: > > [snip] > > > Ain't that "memberships" relationship redundant with passenger->flight- > > > > >operator->memberships ? > > > I reckon he probably wants to do is split passenger up: > > > class Passenger(models.Model): > > customer = models.ForeignKey(User) > > flight = models.ForeignKey(Flight) > > > and have memberships as an attribute of the user. > > I'm afraid I don't really get what difference it would make. Note that > my question was genuine - I know zilch about the problem domain, I > don't have the fisrt clue about what an "Alliance" might be, so I > don't know if that relationship is redundant or if it's totally > distinct from what you'd get thru the passenger/flight/operator/ > memberships link.
My assumptions came from analogous cases in the real world. Often companies group together to give some kind of club that customers can sign up to to get benefits of discounts from all companies in the group (reward cards are the most obvious case I can think of). If this is Derek's meaning then the passenger (or I think user) may have memberships to any number of such reward schemes. Also, and airline may be in more than one alliance (or group that offers a certain discount for members). The purpose of the query is to see which reward schemes the passenger is a member of, and what discount they qualify for (the maximum discount would normally prevail). In my mind, the membership sits with the user object, and a passenger record is merely showing that the user is booked onto a flight (so could be renamed 'FlightBooking'). I may be completely wrong of course, and it would be interesting to hear from the OP what his thoughts are. > > > > > > > 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? > > > > How could we know ? There's zero documentation about your models > > > fields, and zero documention about the business rules - specially the > > > ones one relating to "discount" and "qualification". Or are we > > > supposed to use a crystal ball ? > > > You do have a point, but I think he is wanting a vague idea of how to > > go about it rather than for us to write his code for him. Or maybe get > > a discussion going about the pros and cons of different ways of > > querying. > > Here again, my point is that answering the OP question requires some > (implicit) knowledge of the domain that I just don't have - and I'm > probably not the only one here lacking that knowledge. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.