Django model how to add a ManyToManyField on save if condition not reach
<p>I have a model Article which contain a boolean field.</p>

<p>When I add a new Article, if this bool is True, I want my country (which is a ManyToMayField) to bet set with a specific one.</p>

<p>The bool:</p>

<pre><code>global_regions = models.BooleanField('Global', default=True)
</code></pre>

<p>The ManyTomany:</p>

<pre><code>article_country = models.ManyToManyField(Country, verbose_name=_('Country of the article'),
                                 blank=True, null=True,
                                 related_name='country_press_article')
</code></pre>

<p>I tried to do that :</p>

<pre><code>def save(self, *args, **kwargs):
    if (self.article_url[:4] != "http") and (self.article_url[:5] != "https"):
        self.article_url = "https://" + self.article_url
    if not self.slug:
        self.slug = slugify(self.title)
    if self.global_regions == True: #here is the condition
        self.article_country.add(Country.objects.get(id=257))
    super(Article, self).save(*args, **kwargs)
</code></pre>

<p>But, as I was expecting, it doesn't work.</p>

<p>What should I do if I want it to work ?</p>