I'm having problems with customising the django comments framework. I need to add a 'company' field. I've followed the documentation and not really getting anywhere. It's not far from working because when i add COMMENTS_APP = 'comments_app' to my settings.py the 'comments' app dissapears from admin interface. When i try and write a comment it comes up with the company field where it asks for your email, url etc.
I'd like to be able to view all the comments in the admin panel along with the company field i've added.
Do i need to create a admin.py or have i just got something missing?
Here is my code for my customised comments app:
//MODELS
from django.db import models
from django.contrib.comments.models import Comment
class CommentWithAddedFields(Comment):
company = models.CharField(max_length=300)
//FORMS.py
from django import forms
from django.contrib.comments.forms import CommentForm
from comments_app.models import CommentWithAddedFields
class CommentFormWithAddedFields(CommentForm):
company = forms.CharField(max_length=300)
def get_comment_model(self):
return CommentWithAddedFields
def get_comment_create_data(self):
data = super(CommentFormWithAddedFields, self).get_comment_create_data()
data['company'] = self.cleaned_data['company']
return data
//__init.py
from comments_app.models import CommentWithAddedFields
from comments_app.forms import CommentFormWithAddedFields
def get_model():
return CommentWithAddedFields
def get_form():
return CommentFormWithAddedFields
I have added the app in the my settings.py file and added COMMENTS_APP = 'comments_app' as i mentioned above.
Am I missed something?
Thanks