ManyToManyField को परिभाषित करें आपके किसी एक मॉडल पर (उदा. Sample ) एक through . निर्दिष्ट करना विकल्प के रूप में यहां प्रलेखितए> ए> :
class Sample(models.Model):
id = ...
containers = models.ManyToManyField(Container, through='JoinSampleContainer', through_fields=('sample_id', 'container_id'),
related_name='samples')
नोट:पठनीयता के लिए आपको अपने मॉडल में फ़ील्ड को नाम देना चाहिए (और db_column . का उपयोग करें) उपयोग किए जाने वाले डीबी कॉलम को निर्दिष्ट करने के लिए)। id का उपयोग करें sample_id . के बजाय , यह sample.id . का उपयोग करने के लिए अधिक पठनीय है sample.sample_id . के बजाय . और Sample का उपयोग करें sample_id . के बजाय , सम्मान container container_id . के बजाय थ्रू मॉडल पर।