concepts.admin module

class concepts.admin.ConceptActionForm(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)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('_selected_action', <django.forms.fields.CharField object>), ('action', <django.forms.fields.CharField object>), ('confirmed', <django.forms.fields.BooleanField object>)])
declared_fields = OrderedDict([('_selected_action', <django.forms.fields.CharField object>), ('action', <django.forms.fields.CharField object>), ('confirmed', <django.forms.fields.BooleanField object>)])
media
class concepts.admin.ConceptAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

actions = (<function merge_concepts>, <function approve_concepts>, <function add_concepts_to_conceptpower>, <function resolve>)
list_display = ('label', 'description', 'concept_state', 'typed')
list_filter = ('concept_state', 'typed')
media
model

alias of Concept

search_fields = ('label',)
class concepts.admin.ConceptMergeForm(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)[source]

Bases: django.forms.forms.Form

The administrator can select one Concept instance into which all other selected Concept instances will be merged.

base_fields = OrderedDict([('master_concept', <concepts.admin.ModelChoiceFieldWithDescriptions object>), ('_selected_action', <django.forms.fields.CharField object>), ('action', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict([('master_concept', <concepts.admin.ModelChoiceFieldWithDescriptions object>), ('_selected_action', <django.forms.fields.CharField object>), ('action', <django.forms.fields.CharField object>)])
media
class concepts.admin.ModelChoiceFieldWithDescriptions(*args, **kwargs)[source]

Bases: django.forms.models.ModelChoiceField

choices
class concepts.admin.ModelChoiceIteratorWithDescriptions(field)[source]

Bases: django.forms.models.ModelChoiceIterator

choice(obj)[source]
class concepts.admin.RadioChoiceInputWithDescription(name, value, attrs, choice, index, **kwargs)[source]

Bases: django.forms.widgets.RadioChoiceInput

render(name=None, value=None, attrs=None)[source]
class concepts.admin.RadioFieldRendererWithDescription(name, value, attrs, choices, **kwargs)[source]

Bases: django.forms.widgets.RadioFieldRenderer

choice_input_class

alias of RadioChoiceInputWithDescription

render()[source]

Outputs a <ul> for this set of choice fields. If an id was given to the field, it is applied to the <ul> (each item in the list will get an id of $id_$i).

class concepts.admin.RadioSelectWithDescriptions(*args, **kwargs)[source]

Bases: django.forms.widgets.RadioSelect

get_renderer(name, value, attrs=None, **kwargs)[source]

Returns an instance of the renderer.

media
render(name, value, attrs=None)[source]
renderer

alias of RadioFieldRendererWithDescription

class concepts.admin.TypeAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('label', 'resolved')
media
model

alias of Type

concepts.admin.add_concepts_to_conceptpower(modeladmin, request, queryset)[source]

Adds Concepts in queryset to the Conceptpower authority service.

TODO: add a confirmation step that shows similar concepts that already exist.

Parameters:
  • modeladmin
  • request
  • queryset
concepts.admin.approve_concepts(modeladmin, request, queryset)[source]
concepts.admin.merge_concepts(modeladmin, request, queryset)[source]

An administrator should be able to merge concepts in the concept change list view.

Parameters:
  • modeladmin (ConceptAdmin) –
  • request (HttpRequest) –
  • queryset (QuerySet) – Should contain two or more :class:.`Concept` instances.
Returns:

POST request.

Return type:

HttpResponse

concepts.admin.perform_merge(unresolved_concepts, master_concept)[source]

Merge a set of unresolved concepts into a single master concept.

concepts.admin.resolve(modeladmin, request, queryset)[source]
concepts.admin.traverse_mergers(concept)[source]

Recursively collect all IDs for concepts that have been merged into concept.