-1

I have a default m2m relationship between Stage and Pipeline (without through model). I have another model (StageHistory) that needs a m2o relationship with the data saved on the table created by the m2m relationship stage-pipeline.

So what i should write on "pipeline_stage" field ?

class Stage(models.Model):
    #other fields

class Pipeline(models.Model):
    stages = models.ManyToManyField('Stage')
    #other fields


class StageHistory(models.Model):
    pipeline_stage = models.ForeignKey(HERE)

Should I create a "through" model ?

Nathaniel
  • 666
  • 4
  • 15
joao
  • 97
  • 1
  • 10
  • Did you really understood the problem? I want a m2o between StageHistory and the m2m created by Stage - Pipeline. I don't want a m2o between stagehistory and pipeline as you suggest! – joao Feb 25 '13 at 15:09

1 Answers1

0

You should be able to use Pipeline.stages.through to reference the through table.

If not, you could use an explicit through table and use that as the FK target.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895