cms.contrib.keywords package¶
Subpackages¶
Submodules¶
cms.contrib.keywords.admin module¶
-
class
cms.contrib.keywords.admin.
KeywordAdmin
(model, admin_site)¶ Bases:
cms.contrib.admin.admin.CMSAdmin
,cms.core.translations.admin.TranslationAdmin
-
fieldsets
= ((<django.utils.functional.__proxy__ object at 0x557ef10>, {'fields': ['title', 'slug']}),)¶
-
get_created_date
(obj)¶
-
get_title
(obj)¶
-
list_display
= ('get_created_date', 'get_title')¶
-
list_exclude
= ('get_changelist_meta',)¶
-
media
¶
-
prepopulated_fields
= {'slug': ('title',)}¶
-
cms.contrib.keywords.cms_initialize module¶
-
class
cms.contrib.keywords.cms_initialize.
CMSInitialize
¶ Bases:
cms.core.models.CMSInitializeBase
-
models
= (<class 'cms.contrib.keywords.models.Keyword'>,)¶
-
now_fields
= ('created_date', 'modified_date')¶
-
cms.contrib.keywords.cms_plugin module¶
cms.contrib.keywords.fields module¶
-
class
cms.contrib.keywords.fields.
KeywordsField
(*args, **kwargs)¶ Bases:
cms.core.fields.BaseGenericRelation
Stores the keywords as a single string into the
KEYWORDS_FIELD_NAME_string
field for convenient access when searching.-
fields
= {'%s_string': <django.db.models.fields.CharField>}¶
-
formfield
(**kwargs)¶ Provide the custom form widget for the admin, since there isn’t a form field mapped to
GenericRelation
model fields.
-
save_form_data
(instance, data)¶ The
KeywordsWidget
field will return data as a string of comma separated IDs for theKeyword
model - convert these into actualAssignedKeyword
instances. Also deleteKeyword
instances if their last relatedAssignedKeyword
instance is being removed.
-
cms.contrib.keywords.management module¶
-
cms.contrib.keywords.management.
create_group
(sender, **kwargs)¶
cms.contrib.keywords.managers module¶
-
class
cms.contrib.keywords.managers.
KeywordManager
¶ Bases:
django.db.models.manager.Manager
-
delete_unused
(keyword_ids=None)¶ Removes all instances that are not assigned to any object. Limits processing to
keyword_ids
if given.
-
get_by_natural_key
(value)¶ Provides natural key method.
-
get_or_create_iexact
(**kwargs)¶ Case insensitive title version of
get_or_create
. Also allows for multiple existing results.
-
cms.contrib.keywords.models module¶
-
class
cms.contrib.keywords.models.
AssignedKeyword
(*args, **kwargs)¶ Bases:
cms.core.models.Orderable
A
Keyword
assigned to a model instance.-
exception
AssignedKeyword.
DoesNotExist
¶
-
exception
AssignedKeyword.
MultipleObjectsReturned
¶
-
AssignedKeyword.
content_object
¶ Provides a generic relation to any object through content-type/object-id fields.
-
AssignedKeyword.
content_type
¶
-
AssignedKeyword.
keyword
¶
-
AssignedKeyword.
objects
= <django.db.models.manager.Manager object at 0x4104c10>¶
-
AssignedKeyword.
order_with_respect_to
= 'content_object'¶
-
exception
-
class
cms.contrib.keywords.models.
Keyword
(*args, **kwargs)¶ Bases:
cms.core.models.BaseData
,cms.core.models.Slugged
Keywords/tags which are managed via a custom Javascript based widget in the admin.
-
exception
DoesNotExist
¶
-
exception
Keyword.
MultipleObjectsReturned
¶
-
class
Keyword.
Settings
¶
-
Keyword.
assignments
¶
-
Keyword.
clean_fields
(exclude=None)¶
-
Keyword.
created_by
¶
-
Keyword.
get_next_by_created_date
(*moreargs, **morekwargs)¶
-
Keyword.
get_next_by_modified_date
(*moreargs, **morekwargs)¶
-
Keyword.
get_previous_by_created_date
(*moreargs, **morekwargs)¶
-
Keyword.
get_previous_by_modified_date
(*moreargs, **morekwargs)¶
-
Keyword.
modified_by
¶
-
Keyword.
objects
= <cms.core.translations.translator.NewMultilingualManager object at 0x4101fd0>¶
-
Keyword.
slug
¶ A descriptor used for the original translated field.
-
Keyword.
title
¶ A descriptor used for the original translated field.
-
exception
cms.contrib.keywords.urls module¶
cms.contrib.keywords.views module¶
-
class
cms.contrib.keywords.views.
KeywordsAdminSubmitView
(**kwargs)¶ Bases:
django.views.generic.base.View
-
post
(*args, **kwargs)¶ Adds any new given keywords from the custom keywords field in the admin, and returns their IDs for use when saving a model with a keywords field.
-
cms.contrib.keywords.widgets module¶
-
class
cms.contrib.keywords.widgets.
KeywordsWidget
(attrs=None, xxx=None)¶ Bases:
django.forms.widgets.MultiWidget
Form field for the
KeywordsField
generic relation field. Since the admin with model forms has no form field for generic relations, this form field provides a single field for managing the keywords. It contains two actual widgets, a text input for entering keywords, and a hidden input that stores the ID of eachKeyword
instance.The attached JavaScript adds behaviour so that when the form is submitted, an AJAX post is made that passes the list of keywords in the text input, and returns a list of keyword IDs which are then entered into the hidden input before the form submits. The list of IDs in the hidden input is what is used when retrieving an actual value from the field for the form.
-
class
Media
¶ -
css
= {'all': ['//127.0.0.1:8080/static/cms/css/admin/contrib.keywords.keyword.css']}¶
-
css_all
= ('contrib.keywords.keyword.css',)¶
-
extra
= ''¶
-
js
= ['//127.0.0.1:8080/static/cms/js/admin/contrib.keywords.keyword.js']¶
-
url
= 'contrib.keywords.keyword.js'¶
-
-
KeywordsWidget.
decompress
(value)¶ Takes the sequence of
AssignedKeyword
instances and splits them into lists of keyword IDs and titles each mapping to one of the form field widgets.
-
KeywordsWidget.
format_output
(rendered_widgets)¶ Wraps the output HTML with a list of all available
Keyword
instances that can be clicked on to toggle a keyword.Apply only to the querset, because in admin we want only the title.
-
KeywordsWidget.
media
¶
-
KeywordsWidget.
value_from_datadict
(data, files, name)¶ Return the comma separated list of keyword IDs for use in
KeywordsField.save_form_data()
.
-
class