I have two models as shown below. ArticlePost is related to Article by a Foreign Key. I'm wanting to remove name
as a primary key on Article
and instead have the Django default id
field. What is the best steps to do this so that all related ArticlePost
s will maintain the correct Foreign Key to Article
?
class Article(models.Model):
name = models.CharField(max_length=200, primary_key=True)
class ArticlePost(models.Model):
article = models.ForeignKey(Article, null=False, db_index=True)
created_at = models.DateTimeField(auto_now_add=True)
comment = models.TextField(blank=True)