tags_input.admin module

class tags_input.admin.TagsInputAdmin(model, admin_site)[source]

Bases: tags_input.admin.TagsInputMixin, django.contrib.admin.options.ModelAdmin

action_checkbox(obj)

A list_display column containing a checkbox widget.

action_form

alias of ActionForm

actions = []
actions_on_bottom = False
actions_on_top = True
actions_selection_counter = True
add_form_template = None
add_view(request, form_url=u'', extra_context=None)
change_form_template = None
change_list_template = None
change_view(request, object_id, form_url=u'', extra_context=None)
changeform_view(*args, **kwargs)
changelist_view(*args, **kwargs)

The ‘change list’ admin view for this model.

check(**kwargs)
checks_class

alias of ModelAdminChecks

construct_change_message(request, form, formsets, add=False)

Construct a JSON structure describing changes from a changed object.

date_hierarchy = None
delete_confirmation_template = None
delete_model(request, obj)

Given a model instance delete it from the database.

delete_selected_confirmation_template = None
delete_view(*args, **kwargs)
exclude = None
fields = None
fieldsets = None
filter_horizontal = ()
filter_vertical = ()
form

alias of ModelForm

formfield_for_choice_field(db_field, request, **kwargs)

Get a form Field for a database Field that has declared choices.

formfield_for_dbfield(db_field, request, **kwargs)

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

formfield_for_foreignkey(db_field, request, **kwargs)

Get a form Field for a ForeignKey.

formfield_for_manytomany(db_field, request=None, **kwargs)

Get a form Field for a ManyToManyField.

formfield_overrides = {}
get_action(action)

Return a given action from a parameter, which can either be a callable, or the name of a method on the ModelAdmin. Return is a tuple of (callable, name, description).

get_action_choices(request, default_choices=[(u'', u'---------')])

Return a list of choices for use in a form object. Each choice is a tuple (name, description).

get_actions(request)

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

get_changeform_initial_data(request)

Get the initial form data. Unless overridden, this populates from the GET params.

get_changelist(request, **kwargs)

Returns the ChangeList class for use on the changelist page.

get_changelist_form(request, **kwargs)

Returns a Form class for use in the Formset on the changelist page.

get_changelist_formset(request, **kwargs)

Returns a FormSet class for use on the changelist page if list_editable is used.

get_empty_value_display()

Return the empty_value_display set on ModelAdmin or AdminSite.

get_exclude(request, obj=None)

Hook for specifying exclude.

get_field_queryset(db, db_field, request)

If the ModelAdmin specifies ordering, the queryset should respect that ordering. Otherwise don’t specify the queryset, let the field decide (returns None in that case).

get_fields(request, obj=None)
get_fieldsets(request, obj=None)

Hook for specifying fieldsets.

get_form(request, obj=None, **kwargs)

Returns a Form class for use in the admin add view. This is used by add_view and change_view.

get_formsets_with_inlines(request, obj=None)

Yields formsets and the corresponding inlines.

get_inline_formsets(request, formsets, inline_instances, obj=None)
get_inline_instances(request, obj=None)
get_list_display(request)

Return a sequence containing the fields to be displayed on the changelist.

Return a sequence containing the fields to be displayed as links on the changelist. The list_display parameter is the list of fields returned by get_list_display().

get_list_filter(request)

Returns a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page.

Returns a list of fields to add to the select_related() part of the changelist items query.

get_model_perms(request)

Returns a dict of all perms for this model. This dict has the keys add, change, and delete mapping to the True/False for each of those actions.

get_object(request, object_id, from_field=None)

Returns an instance matching the field and value provided, the primary key is used if no field is provided. Returns None if no match is found or the object_id fails validation.

get_ordering(request)

Hook for specifying field ordering.

get_paginator(request, queryset, per_page, orphans=0, allow_empty_first_page=True)
get_prepopulated_fields(request, obj=None)

Hook for specifying custom prepopulated fields.

get_preserved_filters(request)

Returns the preserved filters querystring.

get_queryset(request)

Returns a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

get_readonly_fields(request, obj=None)

Hook for specifying custom readonly fields.

get_search_fields(request)

Returns a sequence containing the fields to be searched whenever somebody submits a search query.

get_search_results(request, queryset, search_term)

Returns a tuple containing a queryset to implement the search, and a boolean indicating if the results may contain duplicates.

get_urls()
get_view_on_site_url(obj=None)
has_add_permission(request)

Returns True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)

Returns True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.

has_delete_permission(request, obj=None)

Returns True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

has_module_permission(request)

Returns True if the given request has any permission in the given app label.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.

history_view(request, object_id, extra_context=None)

The ‘history’ admin view for this model.

inlines = []
list_display = (u'__str__',)
list_editable = ()
list_filter = ()
list_max_show_all = 200
list_per_page = 100
log_addition(request, object, message)

Log that an object has been successfully added.

The default implementation creates an admin LogEntry object.

log_change(request, object, message)

Log that an object has been successfully changed.

The default implementation creates an admin LogEntry object.

log_deletion(request, object, object_repr)

Log that an object will be deleted. Note that this method must be called before the deletion.

The default implementation creates an admin LogEntry object.

lookup_allowed(lookup, value)
media
message_user(request, message, level=20, extra_tags=u'', fail_silently=False)

Send a message to the user. The default implementation posts a message using the django.contrib.messages backend.

Exposes almost the same API as messages.add_message(), but accepts the positional arguments in a different order to maintain backwards compatibility. For convenience, it accepts the level argument as a string rather than the usual level number.

object_history_template = None
ordering = None
paginator

alias of Paginator

popup_response_template = None
prepopulated_fields = {}
preserve_filters = True
radio_fields = {}
raw_id_fields = ()
readonly_fields = ()
render_change_form(request, context, add=False, change=False, form_url=u'', obj=None)
render_delete_form(request, context)
response_action(request, queryset)

Handle an admin action. This is called if a request is POSTed to the changelist; it returns an HttpResponse if the action was handled, and None otherwise.

response_add(request, obj, post_url_continue=None)

Determines the HttpResponse for the add_view stage.

response_change(request, obj)

Determines the HttpResponse for the change_view stage.

response_delete(request, obj_display, obj_id)

Determines the HttpResponse for the delete_view stage.

response_post_save_add(request, obj)

Figure out where to redirect after the ‘Save’ button has been pressed when adding a new object.

response_post_save_change(request, obj)

Figure out where to redirect after the ‘Save’ button has been pressed when editing an existing object.

save_as = False
save_as_continue = True
save_form(request, form, change)

Given a ModelForm return an unsaved instance. change is True if the object is being changed, and False if it’s being added.

save_formset(request, form, formset, change)

Given an inline formset save it to the database.

save_model(request, obj, form, change)

Given a model instance save it to the database.

save_on_top = False

Given the HttpRequest, the parent ModelForm instance, the list of inline formsets and a boolean value based on whether the parent is being added or changed, save the related objects to the database. Note that at this point save_form() and save_model() have already been called.

search_fields = ()
show_full_result_count = True
to_field_allowed(request, to_field)

Returns True if the model associated with this admin should be allowed to be referenced by the specified field.

urls
view_on_site = True
class tags_input.admin.TagsInputMixin[source]

Bases: object

formfield_for_manytomany(db_field, request=None, **kwargs)[source]

Get a form Field for a ManyToManyField.

class tags_input.admin.TagsInputStackedInline(parent_model, admin_site)[source]

Bases: tags_input.admin.TagsInputMixin, django.contrib.admin.options.StackedInline

can_delete = True
check(**kwargs)
checks_class

alias of InlineModelAdminChecks

classes = None
exclude = None
extra = 3
fields = None
fieldsets = None
filter_horizontal = ()
filter_vertical = ()
fk_name = None
form

alias of ModelForm

formfield_for_choice_field(db_field, request, **kwargs)

Get a form Field for a database Field that has declared choices.

formfield_for_dbfield(db_field, request, **kwargs)

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

formfield_for_foreignkey(db_field, request, **kwargs)

Get a form Field for a ForeignKey.

formfield_for_manytomany(db_field, request=None, **kwargs)

Get a form Field for a ManyToManyField.

formfield_overrides = {}
formset

alias of BaseInlineFormSet

get_empty_value_display()

Return the empty_value_display set on ModelAdmin or AdminSite.

get_exclude(request, obj=None)

Hook for specifying exclude.

get_extra(request, obj=None, **kwargs)

Hook for customizing the number of extra inline forms.

get_field_queryset(db, db_field, request)

If the ModelAdmin specifies ordering, the queryset should respect that ordering. Otherwise don’t specify the queryset, let the field decide (returns None in that case).

get_fields(request, obj=None)
get_fieldsets(request, obj=None)

Hook for specifying fieldsets.

get_formset(request, obj=None, **kwargs)

Returns a BaseInlineFormSet class for use in admin add/change views.

get_max_num(request, obj=None, **kwargs)

Hook for customizing the max number of extra inline forms.

get_min_num(request, obj=None, **kwargs)

Hook for customizing the min number of inline forms.

get_ordering(request)

Hook for specifying field ordering.

get_prepopulated_fields(request, obj=None)

Hook for specifying custom prepopulated fields.

get_queryset(request)
get_readonly_fields(request, obj=None)

Hook for specifying custom readonly fields.

get_view_on_site_url(obj=None)
has_add_permission(request)
has_change_permission(request, obj=None)
has_delete_permission(request, obj=None)
has_module_permission(request)

Returns True if the given request has any permission in the given app label.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.

lookup_allowed(lookup, value)
max_num = None
media
min_num = None
model = None
ordering = None
prepopulated_fields = {}
radio_fields = {}
raw_id_fields = ()
readonly_fields = ()
show_full_result_count = True
template = u'admin/edit_inline/stacked.html'
to_field_allowed(request, to_field)

Returns True if the model associated with this admin should be allowed to be referenced by the specified field.

verbose_name = None
verbose_name_plural = None
view_on_site = True
class tags_input.admin.TagsInputTabularInline(parent_model, admin_site)[source]

Bases: tags_input.admin.TagsInputMixin, django.contrib.admin.options.TabularInline

can_delete = True
check(**kwargs)
checks_class

alias of InlineModelAdminChecks

classes = None
exclude = None
extra = 3
fields = None
fieldsets = None
filter_horizontal = ()
filter_vertical = ()
fk_name = None
form

alias of ModelForm

formfield_for_choice_field(db_field, request, **kwargs)

Get a form Field for a database Field that has declared choices.

formfield_for_dbfield(db_field, request, **kwargs)

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

formfield_for_foreignkey(db_field, request, **kwargs)

Get a form Field for a ForeignKey.

formfield_for_manytomany(db_field, request=None, **kwargs)

Get a form Field for a ManyToManyField.

formfield_overrides = {}
formset

alias of BaseInlineFormSet

get_empty_value_display()

Return the empty_value_display set on ModelAdmin or AdminSite.

get_exclude(request, obj=None)

Hook for specifying exclude.

get_extra(request, obj=None, **kwargs)

Hook for customizing the number of extra inline forms.

get_field_queryset(db, db_field, request)

If the ModelAdmin specifies ordering, the queryset should respect that ordering. Otherwise don’t specify the queryset, let the field decide (returns None in that case).

get_fields(request, obj=None)
get_fieldsets(request, obj=None)

Hook for specifying fieldsets.

get_formset(request, obj=None, **kwargs)

Returns a BaseInlineFormSet class for use in admin add/change views.

get_max_num(request, obj=None, **kwargs)

Hook for customizing the max number of extra inline forms.

get_min_num(request, obj=None, **kwargs)

Hook for customizing the min number of inline forms.

get_ordering(request)

Hook for specifying field ordering.

get_prepopulated_fields(request, obj=None)

Hook for specifying custom prepopulated fields.

get_queryset(request)
get_readonly_fields(request, obj=None)

Hook for specifying custom readonly fields.

get_view_on_site_url(obj=None)
has_add_permission(request)
has_change_permission(request, obj=None)
has_delete_permission(request, obj=None)
has_module_permission(request)

Returns True if the given request has any permission in the given app label.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.

lookup_allowed(lookup, value)
max_num = None
media
min_num = None
model = None
ordering = None
prepopulated_fields = {}
radio_fields = {}
raw_id_fields = ()
readonly_fields = ()
show_full_result_count = True
template = u'admin/edit_inline/tabular.html'
to_field_allowed(request, to_field)

Returns True if the model associated with this admin should be allowed to be referenced by the specified field.

verbose_name = None
verbose_name_plural = None
view_on_site = True