1
.. _ref-contrib-comments-models:
3
===========================
4
The built-in comment models
5
===========================
7
.. module:: django.contrib.comments.models
8
:synopsis: The built-in comment models
12
Django's built-in comment model. Has the following fields:
14
.. attribute:: content_object
16
A :class:`~django.contrib.contettypes.generic.GenericForeignKey`
17
attribute pointing to the object the comment is attached to. You can use
18
this to get at the related object (i.e. ``my_comment.content_object``).
21
:class:`~django.contrib.contettypes.generic.GenericForeignKey`, it's
22
actually syntactic sugar on top of two underlying attributes, described
25
.. attribute:: content_type
27
A :class:`~django.db.models.ForeignKey` to
28
:class:`~django.contrib.contenttypes.models.ContentType`; this is the
29
type of the object the comment is attached to.
31
.. attribute:: object_pk
33
A :class:`~django.db.models.TextField` containing the primary
34
key of the object the comment is attached to.
38
A :class:`~django.db.models.ForeignKey` to the
39
:class:`~django.contrib.sites.models.Site` on which the comment was
44
A :class:`~django.db.models.ForeignKey` to the
45
:class:`~django.contrib.auth.models.User` who posted the comment.
46
May be blank if the comment was posted by an unauthenticated user.
48
.. attribute:: user_name
50
The name of the user who posted the comment.
52
.. attribute:: user_email
54
The email of the user who posteed the comment.
56
.. attribute:: user_url
58
The URL entered by the person who posted the comment.
60
.. attribute:: comment
62
The actual content of the comment itself.
64
.. attribute:: submit_date
66
The date the comment was submitted.
68
.. attribute:: ip_address
70
The IP address of the user posting the comment.
72
.. attribute:: is_public
74
``False`` if the comment is in moderation (see
75
:ref:`ref-contrib-comments-moderation`); If ``True``, the comment will
76
be displayed on the site.
78
.. attribute:: is_removed
80
``True`` if the comment was removed. Used to keep track of removed
81
comments instead of just deleting them.