diff --git a/CHANGELOG.md b/CHANGELOG.md index 465ef394..b134e802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## 1.9.0 ??? (unreleased) ### Features -- Add a "field type" property for custom fields: 'text' and 'multiline text' right now (thanks to [@artlepool](https://github.com/artlepool)). +- Add a "field type" property for custom fields: 'text', 'multiline text' and 'date' right now (thanks to [@artlepool](https://github.com/artlepool)). - Allow multiple actions in the commit messages. - Now every user that coments USs, Issues or Tasks will be involved in it (add author to the watchers list). - Fix the compatibility with BitBucket webhooks and add issues and issues comments integration. diff --git a/taiga/projects/custom_attributes/choices.py b/taiga/projects/custom_attributes/choices.py new file mode 100644 index 00000000..9c3e8468 --- /dev/null +++ b/taiga/projects/custom_attributes/choices.py @@ -0,0 +1,28 @@ +# Copyright (C) 2014-2015 Andrey Antukh +# Copyright (C) 2014-2015 Jesús Espino +# Copyright (C) 2014-2015 David Barragán +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django.utils.translation import ugettext_lazy as _ + + +TEXT_TYPE = "text" +MULTILINE_TYPE = "multiline" +DATE_TYPE = "date" + +TYPES_CHOICES = ( + (TEXT_TYPE, _("Text")), + (MULTILINE_TYPE, _("Multi-Line Text")), + (DATE_TYPE, _("Date")) +) diff --git a/taiga/projects/custom_attributes/migrations/0006_add_customattribute_field_type.py b/taiga/projects/custom_attributes/migrations/0006_add_customattribute_field_type.py deleted file mode 100644 index 8a4aebb8..00000000 --- a/taiga/projects/custom_attributes/migrations/0006_add_customattribute_field_type.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('custom_attributes', '0005_auto_20150505_1639'), - ] - - operations = [ - migrations.AddField( - model_name='issuecustomattribute', - name='field_type', - field=models.CharField(max_length=5, verbose_name='type', choices=[('TEXT', 'Text'), ('MULTI', 'Multi-Line Text')], default='TEXT'), - preserve_default=True, - ), - migrations.AddField( - model_name='taskcustomattribute', - name='field_type', - field=models.CharField(max_length=5, verbose_name='type', choices=[('TEXT', 'Text'), ('MULTI', 'Multi-Line Text')], default='TEXT'), - preserve_default=True, - ), - migrations.AddField( - model_name='userstorycustomattribute', - name='field_type', - field=models.CharField(max_length=5, verbose_name='type', choices=[('TEXT', 'Text'), ('MULTI', 'Multi-Line Text')], default='TEXT'), - preserve_default=True, - ), - ] diff --git a/taiga/projects/custom_attributes/migrations/0006_auto_20151014_1645.py b/taiga/projects/custom_attributes/migrations/0006_auto_20151014_1645.py new file mode 100644 index 00000000..85698a38 --- /dev/null +++ b/taiga/projects/custom_attributes/migrations/0006_auto_20151014_1645.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('custom_attributes', '0005_auto_20150505_1639'), + ] + + operations = [ + migrations.AddField( + model_name='issuecustomattribute', + name='type', + field=models.CharField(default='text', choices=[('text', 'Text'), ('multiline', 'Multi-Line Text'), ('date', 'Date')], verbose_name='type', max_length=16), + ), + migrations.AddField( + model_name='taskcustomattribute', + name='type', + field=models.CharField(default='text', choices=[('text', 'Text'), ('multiline', 'Multi-Line Text'), ('date', 'Date')], verbose_name='type', max_length=16), + ), + migrations.AddField( + model_name='userstorycustomattribute', + name='type', + field=models.CharField(default='text', choices=[('text', 'Text'), ('multiline', 'Multi-Line Text'), ('date', 'Date')], verbose_name='type', max_length=16), + ), + ] diff --git a/taiga/projects/custom_attributes/models.py b/taiga/projects/custom_attributes/models.py index e75a34e1..51c81db6 100644 --- a/taiga/projects/custom_attributes/models.py +++ b/taiga/projects/custom_attributes/models.py @@ -22,6 +22,8 @@ from django_pgjson.fields import JsonField from taiga.projects.occ.mixins import OCCModelMixin +from . import choices + ###################################################### # Custom Attribute Models @@ -29,13 +31,11 @@ from taiga.projects.occ.mixins import OCCModelMixin class AbstractCustomAttribute(models.Model): - FIELD_TYPES = ( - ("TEXT", _("Text")), - ("MULTI", _("Multi-Line Text")) - ) name = models.CharField(null=False, blank=False, max_length=64, verbose_name=_("name")) description = models.TextField(null=False, blank=True, verbose_name=_("description")) - field_type = models.CharField(null=False, blank=False, choices=FIELD_TYPES, max_length=5, default="TEXT", verbose_name=_("type")) + type = models.CharField(null=False, blank=False, max_length=16, + choices=choices.TYPES_CHOICES, default=choices.TEXT_TYPE, + verbose_name=_("type")) order = models.IntegerField(null=False, blank=False, default=10000, verbose_name=_("order")) project = models.ForeignKey("projects.Project", null=False, blank=False, related_name="%(class)ss", verbose_name=_("project"))