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