cms.contrib.comments package¶
Subpackages¶
Submodules¶
cms.contrib.comments.admin module¶
-
class
cms.contrib.comments.admin.
CommentableAdmin
¶ Bases:
object
Admin class for models that subclass the abstract
Commentable
model.-
fieldsets_append
= {<django.utils.functional.__proxy__ object at 0x5995590>: (('comments_allow', 'comments_close'),)}¶
-
list_filter_append
= (<class 'cms.contrib.comments.filters.CommentableFilter'>,)¶
-
-
class
cms.contrib.comments.admin.
CommentsItemAdmin
(model, admin_site)¶ Bases:
django.contrib.comments.admin.CommentsAdmin
,cms.contrib.admin.admin.CMSAdmin
,cms.core.translations.admin.TranslationAdmin
Admin class for comments.
-
action_flag_comments
(dummy, request, queryset)¶
-
action_publish_comments
(dummy, request, queryset)¶
-
action_remove_comments
(dummy, request, queryset)¶
-
autocomplete_lookup_fields
= {'m2m': ['site'], 'fk': ['user']}¶
-
fieldsets
= ((<django.utils.functional.__proxy__ object at 0x58af2d0>, {'fields': ['user_name', 'user_email', 'user_url', 'browser', 'ip_address', ('submit_date', 'flag')]}), (<django.utils.functional.__proxy__ object at 0x5983e50>, {'fields': [('is_public', 'is_removed')]}), (<django.utils.functional.__proxy__ object at 0x5983c90>, {'fields': ['comment']}), (<django.utils.functional.__proxy__ object at 0x5983e10>, {'fields': ['user', 'site']}))¶
-
get_actions
(request)¶
-
get_content_object
(obj)¶
-
get_intro
(obj)¶
-
get_language_verbose
(obj)¶
-
get_queryset
(request)¶
-
get_submit_date
(obj)¶
-
get_username_image
(obj)¶
-
list_display
= ('get_submit_date', 'get_username_image', 'get_intro', 'get_content_object', 'get_language_verbose')¶
-
list_display_links
= ('get_submit_date',)¶
-
list_display_meta
= ('is_public', 'is_removed', 'flag')¶
-
list_filter
= ('submit_date', 'is_public', 'is_removed', 'flag', 'user')¶
-
list_stats_queryset_by
= ('submit_date',)¶
-
media
¶
-
queryset
(*args, **kwargs)¶
-
raw_id_fields
= ('user', 'site')¶
-
-
class
cms.contrib.comments.admin.
CommentsItemApprovalAdminNotification
¶ Bases:
cms.contrib.admin.admin.AdminNotification
-
description
= <django.utils.functional.__proxy__ object at 0x5995790>¶
-
get_objects
(request)¶
-
get_title
(request, count)¶
-
get_url
(request)¶
-
model
¶ alias of
CommentsItem
-
perms
= ('delete_comment',)¶
-
-
class
cms.contrib.comments.admin.
CommentsItemInline
(parent_model, admin_site)¶ Bases:
cms.contrib.admin.admin.CMSGenericStackedInline
-
ct_fk_field
= 'object_pk'¶
-
fieldsets
= ((None, {'fields': ['subject', 'comment', ('flag',)]}),)¶
-
formfield_for_dbfield
(db_field, **kwargs)¶
-
get_queryset
(request)¶
-
has_add_permission
(request)¶
-
has_change_permission
(request, obj=None)¶
-
has_delete_permission
(request, obj=None)¶
-
icon_class
= 'icon-noteslist'¶
-
media
¶
-
model
¶ alias of
CommentsItem
-
queryset
(*args, **kwargs)¶
-
template
= 'admin/edit_inline/stacked_notes.html'¶
-
verbose_name
= <django.utils.functional.__proxy__ object at 0x5995150>¶
-
verbose_name_plural
= <django.utils.functional.__proxy__ object at 0x5995510>¶
-
-
class
cms.contrib.comments.admin.
CommentsItemModelstatsDashboardModule
(request)¶ Bases:
cms.contrib.modelstats.modules.ModelstatsDashboardModule
-
date_field
= 'submit_date'¶
-
get_actions
(request)¶
-
get_objects
(request)¶
-
model
¶ alias of
CommentsItem
-
only
= ('comment', 'content_type', 'flag', 'pk', 'subject', 'submit_date', 'user', 'user__email', 'user__image', 'user__meta_url', 'user_email', 'user_name', 'user_url', 'user__first_name', 'user__last_name', 'user__name_middle', 'user__name_prefix', 'user__name_suffix', 'user__username')¶
-
perms
= ('delete_comment',)¶
-
template_recent
= 'grappelli/dashboard/modules/modelstats_comments.html'¶
-
-
class
cms.contrib.comments.admin.
CommentsItemModelstatsUserModule
¶ Bases:
cms.contrib.modelstats.modules.ModelstatsUserModule
-
get_objects
(request)¶
-
has_perms
= True¶
-
model
¶ alias of
CommentsItem
-
-
class
cms.contrib.comments.admin.
CommentsItemRemovalAdminNotification
¶ Bases:
cms.contrib.admin.admin.AdminNotification
-
description
= <django.utils.functional.__proxy__ object at 0x5995850>¶
-
get_objects
(request)¶
-
get_title
(request, count)¶
-
get_url
(request)¶
-
model
¶ alias of
CommentsItem
-
perms
= ('delete_comment',)¶
-
cms.contrib.comments.apps module¶
cms.contrib.comments.autofixtures module¶
-
class
cms.contrib.comments.autofixtures.
CommentsItemFixture
(*args, **kwargs)¶ Bases:
cms.core.dev.autofixtures.base.CMSAutoFixture
-
AUTO
= False¶
-
AUTO_SECOND_RUN
= True¶
-
COUNT_DEFAULT
= 600¶
-
field_values
= {'imageteaser': <autofixture.generators.NoneGenerator object at 0x8331350>, 'title': <autofixture.generators.LoremSentenceGenerator object at 0x8331c90>, 'submit_date': <cms.core.dev.autofixtures.generators.DateTimeMaxNowGenerator object at 0xdcffe50>, 'image': <cms.core.dev.autofixtures.generators.ImageGenerator object at 0x8331290>, 'order': <autofixture.generators.PositiveSmallIntegerGenerator object at 0x8331d90>, 'imageteaserdescription': <autofixture.generators.NoneGenerator object at 0x8331cd0>, 'expired_date': <autofixture.generators.NoneGenerator object at 0x8560590>, 'published_date': <cms.core.dev.autofixtures.generators.DateTimeMaxNowGenerator object at 0x8331d50>, 'replied_to': <autofixture.generators.NoneGenerator object at 0xdcff510>, 'user_name': <cms.core.dev.autofixtures.generators.FullNameGenerator object at 0xdb059d0>, 'slug': <autofixture.generators.NoneGenerator object at 0x8331ad0>, 'pretitle': <autofixture.generators.LoremSentenceGenerator object at 0x8331d10>}¶
-
get_generator
(field)¶
-
cms.contrib.comments.cms_defaults module¶
cms.contrib.comments.cms_plugin module¶
-
class
cms.contrib.comments.cms_plugin.
CMSPlugin
¶ Bases:
cms.core.plugins.CMSPluginBase
-
admin_icon_class
= 'icon-comment'¶
-
description
= <django.utils.functional.__proxy__ object at 0x31ff6d0>¶
-
description_long
= <django.utils.functional.__proxy__ object at 0x31ff710>¶
-
status
= 'stable'¶
-
verbose_name
= <django.utils.functional.__proxy__ object at 0x31ff750>¶
-
version
= '0.3'¶
-
cms.contrib.comments.cms_sitemaps module¶
-
class
cms.contrib.comments.cms_sitemaps.
CommentsItemSitemap
¶ Bases:
cms.contrib.sitemaps.sitemap.SitemapBase
-
get_queryset
(model)¶
-
get_queryset_for_index
(model)¶
-
cms.contrib.comments.fields module¶
-
class
cms.contrib.comments.fields.
CommentsField
(*args, **kwargs)¶ Bases:
cms.core.fields.BaseGenericRelation
Stores the number of comments against the
COMMENTS_FIELD_NAME_count
field when a comment is saved or deleted.-
fields
= {'%s_count': <django.db.models.fields.IntegerField>, '%s_count_all': <django.db.models.fields.IntegerField>}¶
Stores the number of comments. A custom
count_filter
queryset gets checked for, allowing managers to implement custom count logic.
-
cms.contrib.comments.filters module¶
cms.contrib.comments.forms module¶
-
class
cms.contrib.comments.forms.
CommentsItemForm
(request, target_object, data=None, initial=None)¶ Bases:
cms.contrib.comments.forms.CommentsItemSecurityForm
,django.contrib.comments.forms.CommentDetailsForm
-
base_fields
= OrderedDict([('content_type', <django.forms.fields.CharField object at 0x31fce10>), ('object_pk', <django.forms.fields.CharField object at 0x31fce90>), ('timestamp', <django.forms.fields.IntegerField object at 0x31fcf10>), ('security_hash', <django.forms.fields.CharField object at 0x31fcf90>), ('name', <django.forms.fields.CharField object at 0x7a19bd0>), ('email', <django.forms.fields.EmailField object at 0x7a19d90>), ('url', <django.forms.fields.URLField object at 0x7a19f10>), ('comment', <django.forms.fields.CharField object at 0x7a1b290>), ('subject', <django.forms.fields.CharField object at 0x7a1b0d0>)])¶
-
declared_fields
= OrderedDict([('content_type', <django.forms.fields.CharField object at 0x31fce10>), ('object_pk', <django.forms.fields.CharField object at 0x31fce90>), ('timestamp', <django.forms.fields.IntegerField object at 0x31fcf10>), ('security_hash', <django.forms.fields.CharField object at 0x31fcf90>), ('name', <django.forms.fields.CharField object at 0x7a19bd0>), ('email', <django.forms.fields.EmailField object at 0x7a19d90>), ('url', <django.forms.fields.URLField object at 0x7a19f10>), ('comment', <django.forms.fields.CharField object at 0x7a1b290>), ('subject', <django.forms.fields.CharField object at 0x7a1b0d0>)])¶
-
get_comment_model
()¶ Use the custom comment model instead of the built-in one.
-
media
¶
-
save
(request)¶ Saves a new comment and sends any notification emails.
-
-
class
cms.contrib.comments.forms.
CommentsItemSecurityForm
(target_object, data=None, initial=None)¶ Bases:
cms.core.forms.CMSSecurityBaseForm
-
clean_security_hash
()¶
-
clean_timestamp
()¶
-
generate_security_data
()¶ Generate a dict of security data for ‘initial’ data.
-
generate_security_hash
(content_type, object_pk, timestamp)¶ Generate a HMAC security hash from the timestamp.
-
initial_security_hash
(timestamp)¶ Generate the initial security hash from self.content_object and a (unix) timestamp.
-
-
class
cms.contrib.comments.forms.
CommentsItemSpamForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
cms.contrib.comments.managers module¶
-
class
cms.contrib.comments.managers.
CommentManager
¶ Bases:
django.contrib.comments.managers.CommentManager
Provides filter for restricting comments that are not approved if
COMMENTS_COMMENT_UNAPPROVED_VISIBLE
is set toFalse
.-
admin
()¶
-
count_queryset
(lang)¶ Called from
CommentsField.related_items_changed
to store the comment count against an item each time a comment is saved.
-
filter
(*args, **kwargs)¶
-
flag_approval
()¶
-
flag_removal
()¶
-
get_query_set
(*args, **kwargs)¶
-
get_queryset
()¶
-
published
(lang=None)¶ Return the comments that are visible based on the
COMMENTS_*_VISIBLE
settings. When these settings are set toTrue
, the relevant comments are returned that shouldn’t be shown, and are given placeholders in the templategeneric/includes/comment.html
.
-
published_staff
()¶
-
cms.contrib.comments.models module¶
-
class
cms.contrib.comments.models.
CommentsItem
(*args, **kwargs)¶ Bases:
django.contrib.comments.models.Comment
,cms.core.models.BaseData
Extend the
Comment
model fromdjango.contrib.comments
to add comment threading.-
class
ApiPrivate
¶ -
fields
= ('browser', 'by_author', 'comment', 'content_type', 'object_pk', 'flag', 'intro', 'ip_address', 'is_public', 'is_removed', 'is_admin', 'rating_average', 'rating_count', 'rating_sum', 'replied_to', 'replies_count', 'site', 'subject', 'submit_date', 'user', 'user_email', 'user_name', 'user_url', 'userinfo')¶
-
-
CommentsItem.
COMMENT_APPROVAL
= 3¶
-
CommentsItem.
COMMENT_CHOICES
= ((1, <django.utils.functional.__proxy__ object at 0x3e1c9d0>), (2, <django.utils.functional.__proxy__ object at 0x3e1c8d0>), (3, <django.utils.functional.__proxy__ object at 0x3e1c910>))¶
-
CommentsItem.
COMMENT_DELETION
= 2¶
-
CommentsItem.
COMMENT_REMOVAL
= 1¶
-
exception
CommentsItem.
DoesNotExist
¶ Bases:
django.contrib.comments.models.DoesNotExist
-
exception
CommentsItem.
MultipleObjectsReturned
¶ Bases:
django.contrib.comments.models.MultipleObjectsReturned
-
CommentsItem.
clean_fields
(exclude=None)¶
-
CommentsItem.
comment_ptr
¶
-
CommentsItem.
comments
¶
-
CommentsItem.
content_object
¶ Provides a generic relation to any object through content-type/object-id fields.
-
CommentsItem.
created_by
¶
-
CommentsItem.
get_absolute_admin_url
()¶ returns a admin-url for this object
-
CommentsItem.
get_absolute_url
()¶ Use the URL for the comment’s content object, with a URL hash appended that references the individual comment.
-
CommentsItem.
get_flag_boolean_icon
¶
-
CommentsItem.
get_flag_display
(*moreargs, **morekwargs)¶
-
CommentsItem.
get_language
()¶
-
CommentsItem.
get_next_by_created_date
(*moreargs, **morekwargs)¶
-
CommentsItem.
get_next_by_modified_date
(*moreargs, **morekwargs)¶
-
CommentsItem.
get_previous_by_created_date
(*moreargs, **morekwargs)¶
-
CommentsItem.
get_previous_by_modified_date
(*moreargs, **morekwargs)¶
-
CommentsItem.
get_ratingfield_name
()¶
-
CommentsItem.
html_app_id
¶
-
CommentsItem.
html_object_id
¶
-
CommentsItem.
intro
()¶
-
CommentsItem.
modified_by
¶
-
CommentsItem.
objects
= <cms.core.translations.translator.NewMultilingualManager object at 0x3e25290>¶
-
CommentsItem.
rating
¶ This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.
-
CommentsItem.
replied_to
¶
-
CommentsItem.
replies_count
¶ A descriptor used for the original translated field.
-
CommentsItem.
save
(*args, **kwargs)¶
-
CommentsItem.
subject
¶ A descriptor used for the original translated field.
-
CommentsItem.
user_or_email
¶
-
CommentsItem.
userinfo
¶ Get a dictionary that pulls together information about the poster safely for both authenticated and non-authenticated comments.
This dict will have
name
,email
, andurl
fields.
-
class
cms.contrib.comments.monkeypatch module¶
cms.contrib.comments.signals module¶
-
cms.contrib.comments.signals.
add_comments_count
(sender, **kwargs)¶
-
cms.contrib.comments.signals.
substract_comments_count
(sender, **kwargs)¶
cms.contrib.comments.urls module¶
cms.contrib.comments.views module¶
-
class
cms.contrib.comments.views.
CommentsBaseView
(**kwargs)¶ Bases:
cms.core.views.GenericTemplateView
-
get_data
(request, content_type, object_pk, comment_pk=None)¶
-
-
class
cms.contrib.comments.views.
CommentsItemFormView
(**kwargs)¶ Bases:
cms.core.views.GenericTemplateView
-
get
(request)¶
-
post
(request)¶
-
template_name
= 'includes/form_fields.html'¶
-
-
class
cms.contrib.comments.views.
CommentsItemListDetailView
(**kwargs)¶ Bases:
cms.contrib.comments.views.CommentsBaseView
-
get
(request, object_slug, content_type, object_pk, comment_pk, comment_slug)¶
-
template_name
= 'comments/item_list.html'¶
-
-
class
cms.contrib.comments.views.
CommentsItemListView
(**kwargs)¶ Bases:
cms.contrib.comments.views.CommentsBaseView
-
get
(request, object_slug, content_type, object_pk)¶
-
template_name
= 'comments/item_list.html'¶
-
-
class
cms.contrib.comments.views.
CommentsItemSpamView
(**kwargs)¶ Bases:
cms.core.views.GenericCSRFProtectedView
Flag a
CommentsItem
for removol suggestion. Ajax only. CommentsItemSpamForm is for validating security stuff.-
get
(request)¶
-
post
(request)¶
-
-
class
cms.contrib.comments.views.
CommentsItemSubmitView
(**kwargs)¶ Bases:
cms.core.views.GenericTemplateView
Handle a
CommentsItemForm
submission and redirect back to its related object.-
get
(request)¶
-
post
(request)¶
-
template_name
= 'comments/base_inline.html'¶
-
-
class
cms.contrib.comments.views.
CommentsItemView
(**kwargs)¶ Bases:
cms.contrib.comments.views.CommentsBaseView
-
template_name
= 'comments/base.html'¶
-