I am trying to add a new field in django_comment
model. According to the documentation, most custom comment models will subclass the CommentAbstractModel
model:
from django.db import models
from django_comments.models import CommentAbstractModel
class CommentWithTitle(CommentAbstractModel):
title = models.CharField(max_length=300)
If I generate a migration, then it adds all the fields into migrations (all fields from comment model plus title field).
And after running migrations, CommentWithTitle
table and django_comments
table are created. But django_comments
would be useless (not in use).
Another approach is to generate the table this way:
from django_comments.models import Comment
class CommentWithTitle(Comment):
title = models.CharField(max_length=300)
And it generates the migration with one field only with the reference of comment_ptr
.
My Question is: which approach is better? I think the first model is good as it has all fields in one table. But that generates the django_model
which is not in use at all.