Rename source model title field to 'label'.
This commit is contained in:
@@ -71,13 +71,13 @@ class WebFormUploadForm(UploadBaseForm):
|
|||||||
|
|
||||||
class WebFormSetupForm(forms.ModelForm):
|
class WebFormSetupForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = ('title', 'enabled', 'uncompress')
|
fields = ('label', 'enabled', 'uncompress')
|
||||||
model = WebFormSource
|
model = WebFormSource
|
||||||
|
|
||||||
|
|
||||||
class StagingFolderSetupForm(forms.ModelForm):
|
class StagingFolderSetupForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = ('title', 'enabled', 'folder_path', 'preview_width', 'preview_height', 'uncompress', 'delete_after_upload')
|
fields = ('label', 'enabled', 'folder_path', 'preview_width', 'preview_height', 'uncompress', 'delete_after_upload')
|
||||||
model = StagingFolderSource
|
model = StagingFolderSource
|
||||||
|
|
||||||
|
|
||||||
@@ -90,17 +90,17 @@ class EmailSetupBaseForm(forms.ModelForm):
|
|||||||
|
|
||||||
class POP3EmailSetupForm(EmailSetupBaseForm):
|
class POP3EmailSetupForm(EmailSetupBaseForm):
|
||||||
class Meta(EmailSetupBaseForm.Meta):
|
class Meta(EmailSetupBaseForm.Meta):
|
||||||
fields = ('title', 'enabled', 'interval', 'document_type', 'uncompress', 'host', 'ssl', 'port', 'username', 'password', 'timeout')
|
fields = ('label', 'enabled', 'interval', 'document_type', 'uncompress', 'host', 'ssl', 'port', 'username', 'password', 'timeout')
|
||||||
model = POP3Email
|
model = POP3Email
|
||||||
|
|
||||||
|
|
||||||
class IMAPEmailSetupForm(EmailSetupBaseForm):
|
class IMAPEmailSetupForm(EmailSetupBaseForm):
|
||||||
class Meta(EmailSetupBaseForm.Meta):
|
class Meta(EmailSetupBaseForm.Meta):
|
||||||
fields = ('title', 'enabled', 'interval', 'document_type', 'uncompress', 'host', 'ssl', 'port', 'username', 'password', 'mailbox')
|
fields = ('label', 'enabled', 'interval', 'document_type', 'uncompress', 'host', 'ssl', 'port', 'username', 'password', 'mailbox')
|
||||||
model = IMAPEmail
|
model = IMAPEmail
|
||||||
|
|
||||||
|
|
||||||
class WatchFolderSetupForm(forms.ModelForm):
|
class WatchFolderSetupForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = ('title', 'enabled', 'interval', 'document_type', 'uncompress', 'folder_path')
|
fields = ('label', 'enabled', 'interval', 'document_type', 'uncompress', 'folder_path')
|
||||||
model = WatchFolderSource
|
model = WatchFolderSource
|
||||||
|
|||||||
23
mayan/apps/sources/migrations/0005_auto_20150708_0327.py
Normal file
23
mayan/apps/sources/migrations/0005_auto_20150708_0327.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('sources', '0004_auto_20150616_1931'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='source',
|
||||||
|
options={'ordering': ('label',), 'verbose_name': 'Source', 'verbose_name_plural': 'Sources'},
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='source',
|
||||||
|
old_name='title',
|
||||||
|
new_name='label',
|
||||||
|
),
|
||||||
|
]
|
||||||
20
mayan/apps/sources/migrations/0006_auto_20150708_0330.py
Normal file
20
mayan/apps/sources/migrations/0006_auto_20150708_0330.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('sources', '0005_auto_20150708_0327'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='source',
|
||||||
|
name='label',
|
||||||
|
field=models.CharField(max_length=64, verbose_name='Label'),
|
||||||
|
preserve_default=True,
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -37,7 +37,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Source(models.Model):
|
class Source(models.Model):
|
||||||
title = models.CharField(max_length=64, verbose_name=_('Title'))
|
label = models.CharField(max_length=64, verbose_name=_('Label'))
|
||||||
enabled = models.BooleanField(default=True, verbose_name=_('Enabled'))
|
enabled = models.BooleanField(default=True, verbose_name=_('Enabled'))
|
||||||
|
|
||||||
objects = InheritanceManager()
|
objects = InheritanceManager()
|
||||||
@@ -47,10 +47,10 @@ class Source(models.Model):
|
|||||||
return unicode(dict(SOURCE_CHOICES).get(cls.source_type))
|
return unicode(dict(SOURCE_CHOICES).get(cls.source_type))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '%s' % self.title
|
return '%s' % self.label
|
||||||
|
|
||||||
def fullname(self):
|
def fullname(self):
|
||||||
return ' '.join([self.class_fullname(), '"%s"' % self.title])
|
return ' '.join([self.class_fullname(), '"%s"' % self.label])
|
||||||
|
|
||||||
def _upload_document(self, document_type, file_object, label, language, user, description=None, metadata_dict_list=None):
|
def _upload_document(self, document_type, file_object, label, language, user, description=None, metadata_dict_list=None):
|
||||||
document = document_type.new_document(
|
document = document_type.new_document(
|
||||||
@@ -91,7 +91,7 @@ class Source(models.Model):
|
|||||||
# TODO: Should raise NotImplementedError()?
|
# TODO: Should raise NotImplementedError()?
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('title',)
|
ordering = ('label',)
|
||||||
verbose_name = _('Source')
|
verbose_name = _('Source')
|
||||||
verbose_name_plural = _('Sources')
|
verbose_name_plural = _('Sources')
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class UploadDocumentTestCase(TestCase):
|
|||||||
self.assertTrue(self.admin_user.is_authenticated())
|
self.assertTrue(self.admin_user.is_authenticated())
|
||||||
|
|
||||||
# Create new webform source
|
# Create new webform source
|
||||||
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'label': 'test', 'uncompress': 'n', 'enabled': True})
|
||||||
self.assertEqual(WebFormSource.objects.count(), 1)
|
self.assertEqual(WebFormSource.objects.count(), 1)
|
||||||
|
|
||||||
# Upload the test document
|
# Upload the test document
|
||||||
@@ -74,7 +74,7 @@ class UploadDocumentTestCase(TestCase):
|
|||||||
self.assertTrue(self.admin_user.is_authenticated())
|
self.assertTrue(self.admin_user.is_authenticated())
|
||||||
|
|
||||||
# Create new webform source
|
# Create new webform source
|
||||||
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'label': 'test', 'uncompress': 'n', 'enabled': True})
|
||||||
self.assertEqual(WebFormSource.objects.count(), 1)
|
self.assertEqual(WebFormSource.objects.count(), 1)
|
||||||
|
|
||||||
# Upload the test document
|
# Upload the test document
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ def get_tab_link_for_source(source, document=None):
|
|||||||
args = ['"{}"'.format(source.pk)]
|
args = ['"{}"'.format(source.pk)]
|
||||||
|
|
||||||
return Link(
|
return Link(
|
||||||
text=source.title,
|
text=source.label,
|
||||||
view=view,
|
view=view,
|
||||||
args=args,
|
args=args,
|
||||||
keep_query=True,
|
keep_query=True,
|
||||||
@@ -266,7 +266,7 @@ class UploadInteractiveView(UploadBaseView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UploadInteractiveView, self).get_context_data(**kwargs)
|
context = super(UploadInteractiveView, self).get_context_data(**kwargs)
|
||||||
context['title'] = _('Upload a local document from source: %s') % self.source.title
|
context['title'] = _('Upload a local document from source: %s') % self.source.label
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ class UploadInteractiveVersionView(UploadBaseView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UploadInteractiveVersionView, self).get_context_data(**kwargs)
|
context = super(UploadInteractiveVersionView, self).get_context_data(**kwargs)
|
||||||
context['object'] = self.document
|
context['object'] = self.document
|
||||||
context['title'] = _('Upload a new version from source: %s') % self.source.title
|
context['title'] = _('Upload a new version from source: %s') % self.source.label
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user