We have an interesting interest. I shortened the models to make it easier to understand.
class Participant(Person): passport_number = models.IntegerField(verbose_name=_('Passport Number'), db_column=u'PassportNumber') class Meta: db_table = u'Participant' class Journey(BaseModel): participants = models.ManyToManyField(Participant, related_name='%(app_label)s_%(class)s_participants', through=u'ParticipantJourney') class Meta: abstract = True class PlaneJourney(Journey): flight_number = models.CharField(max_length=16, verbose_name=_('Flight Number'), db_column=u'FlightNumber') class Meta: db_table = u'PlaneJourney' class ParticipantJourney(BaseModel): participant = models.ForeignKey(Participant, verbose_name=_('Participant'), db_column=u'ParticipantId') journey_content_type = models.ForeignKey(ContentType, related_name='journey_content_type') journey_object_id = models.PositiveIntegerField() journey = generic.GenericForeignKey('journey_content_type', 'journey_object_id')
The participant-participant model associates the participant with the journey, now the journey is abstract, because it can be performed by any number of different modes of transport, each of which will have its own corresponding fields. I think this setting is correct, but I get the following error message:
Error: one or more models were not confirmed: kandersteg.planejourney: "Participants" is the manually related m2m relationship through the "Participant" model, which does not have foreign keys to the Participant and PlaneJourney
I need to save the manual definition of the link table so that I can also associate the payment with the specified trip, so I really donβt know where to go next with this, if someone can shed some light, I would be really nice!
Cheers, Alex
source share