diff --git a/mayan/apps/document_indexing/admin.py b/mayan/apps/document_indexing/admin.py index d9cd4445f1..f67b73c4fc 100644 --- a/mayan/apps/document_indexing/admin.py +++ b/mayan/apps/document_indexing/admin.py @@ -15,7 +15,7 @@ class IndexTemplateNodeInline(admin.StackedInline): class IndexAdmin(admin.ModelAdmin): filter_horizontal = ('document_types',) inlines = [IndexTemplateNodeInline] - list_display = ('name', 'title', 'enabled', 'get_document_types') + list_display = ('label', 'enabled', 'get_document_types') def get_document_types(self, instance): return ', '.join(['"{0}"'.format(document_type) for document_type in instance.document_types.all()]) or _('None') diff --git a/mayan/apps/document_indexing/migrations/0002_remove_index_name.py b/mayan/apps/document_indexing/migrations/0002_remove_index_name.py new file mode 100644 index 0000000000..3feef24cad --- /dev/null +++ b/mayan/apps/document_indexing/migrations/0002_remove_index_name.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('document_indexing', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='index', + name='name', + ), + ] diff --git a/mayan/apps/document_indexing/migrations/0003_auto_20150708_0101.py b/mayan/apps/document_indexing/migrations/0003_auto_20150708_0101.py new file mode 100644 index 0000000000..8d1c5d60f1 --- /dev/null +++ b/mayan/apps/document_indexing/migrations/0003_auto_20150708_0101.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('document_indexing', '0002_remove_index_name'), + ] + + operations = [ + migrations.RenameField( + model_name='index', + old_name='title', + new_name='label', + ), + ] diff --git a/mayan/apps/document_indexing/models.py b/mayan/apps/document_indexing/models.py index 4c9922d086..b579edd375 100644 --- a/mayan/apps/document_indexing/models.py +++ b/mayan/apps/document_indexing/models.py @@ -15,10 +15,8 @@ from .managers import IndexManager @python_2_unicode_compatible class Index(models.Model): - name = models.CharField(unique=True, max_length=64, verbose_name=_('Name'), help_text=_('Internal name used to reference this index.')) - # TODO: normalize 'title' to 'label' - title = models.CharField(unique=True, max_length=128, verbose_name=_('Title'), help_text=_('The name that will be visible to users.')) - enabled = models.BooleanField(default=True, verbose_name=_('Enabled'), help_text=_('Causes this index to be visible and updated when document data changes.')) + label = models.CharField(max_length=128, unique=True, verbose_name=_('Label')) + enabled = models.BooleanField(default=True, help_text=_('Causes this index to be visible and updated when document data changes.'), verbose_name=_('Enabled')) document_types = models.ManyToManyField(DocumentType, verbose_name=_('Document types')) objects = IndexManager() @@ -32,7 +30,7 @@ class Index(models.Model): return self.template_root.node_instance.get() def __str__(self): - return self.title + return self.label def get_absolute_url(self): try: @@ -48,9 +46,6 @@ class Index(models.Model): def get_document_types_names(self): return ', '.join([unicode(document_type) for document_type in self.document_types.all()] or ['None']) - def natural_key(self): - return (self.name,) - def get_instance_node_count(self): try: return self.instance_root.get_descendant_count() diff --git a/mayan/apps/document_indexing/serializers.py b/mayan/apps/document_indexing/serializers.py index 6b73d83b63..188adac3a0 100644 --- a/mayan/apps/document_indexing/serializers.py +++ b/mayan/apps/document_indexing/serializers.py @@ -30,5 +30,5 @@ class IndexSerializer(serializers.ModelSerializer): instance_root = IndexInstanceNodeSerializer(read_only=True) class Meta: - fields = ('id', 'name', 'title', 'enabled', 'document_types', 'node_templates', 'instance_root') + fields = ('id', 'label', 'enabled', 'document_types', 'node_templates', 'instance_root') model = Index diff --git a/mayan/apps/document_indexing/tests.py b/mayan/apps/document_indexing/tests.py index 374801e96c..b9d7e2d0a8 100644 --- a/mayan/apps/document_indexing/tests.py +++ b/mayan/apps/document_indexing/tests.py @@ -22,7 +22,7 @@ class IndexTestCase(TestCase): DocumentTypeMetadataType.objects.create(document_type=self.document_type, metadata_type=metadata_type) # Create empty index - index = Index.objects.create(name='test', title='test') + index = Index.objects.create(label='test') self.failUnlessEqual(list(Index.objects.all()), [index]) # Add our document type to the new index diff --git a/mayan/apps/document_indexing/views.py b/mayan/apps/document_indexing/views.py index 3404d2f8b6..ac530ddf1c 100644 --- a/mayan/apps/document_indexing/views.py +++ b/mayan/apps/document_indexing/views.py @@ -41,8 +41,7 @@ class SetupIndexListView(SingleObjectListView): 'title': _('Indexes'), 'hide_object': True, 'extra_columns': [ - {'name': _('Name'), 'attribute': 'name'}, - {'name': _('Title'), 'attribute': 'title'}, + {'name': _('Label'), 'attribute': 'label'}, {'name': _('Enabled'), 'attribute': encapsulate(lambda x: two_state_template(x.enabled))}, ] } @@ -384,7 +383,7 @@ def rebuild_index_instances(request): return render_to_response('appearance/generic_confirm.html', { 'previous': previous, 'next': next, - 'title': _('Are you sure you wish to rebuild all indexes?'), + 'title': _('Rebuild all indexes?'), 'message': _('On large databases this operation may take some time to execute.'), }, context_instance=RequestContext(request)) else: