[Answered ]-Adding a value only once in a ManytoMany field across the table

1👍

You just need a foreign key relation for that use case

class Papers(models.Model):
        '''
            All the published papers
        '''
    
        title = models.CharField(max_length=300) # title
        issue = models.ForeignKey(Issues, on_delete=models.CASCADE)
    
        def __str__(self):
            return self.title
    
    
class Issues(models.Model):
        '''
            All issues
        '''
        number = models.SmallIntegerField() # issue number
        
        def __str__(self):
            return str(self.number)

Leave a comment