From 55a1a261f400d13234f96b877ef1fec26a73f27d Mon Sep 17 00:00:00 2001 From: Andrea Stagi Date: Tue, 26 Jan 2016 20:36:06 +0100 Subject: [PATCH] Add new custom attribute type: URL --- CHANGELOG.md | 1 + taiga/projects/custom_attributes/choices.py | 4 +++- taiga/projects/management/commands/sample_data.py | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0b36148..5788587c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## 2.0.0 ??? (unreleased) ### Features +- Ability to create url custom fields. (thanks to [@astagi](https://github.com/astagi)). - Blocked projects support - Transfer projects ownership support - Customizable max private and public projects per user diff --git a/taiga/projects/custom_attributes/choices.py b/taiga/projects/custom_attributes/choices.py index dd6c15e9..fadcc788 100644 --- a/taiga/projects/custom_attributes/choices.py +++ b/taiga/projects/custom_attributes/choices.py @@ -21,9 +21,11 @@ from django.utils.translation import ugettext_lazy as _ TEXT_TYPE = "text" MULTILINE_TYPE = "multiline" DATE_TYPE = "date" +URL_TYPE = "url" TYPES_CHOICES = ( (TEXT_TYPE, _("Text")), (MULTILINE_TYPE, _("Multi-Line Text")), - (DATE_TYPE, _("Date")) + (DATE_TYPE, _("Date")), + (URL_TYPE, _("Url")) ) diff --git a/taiga/projects/management/commands/sample_data.py b/taiga/projects/management/commands/sample_data.py index 4af2c699..02d6ad54 100644 --- a/taiga/projects/management/commands/sample_data.py +++ b/taiga/projects/management/commands/sample_data.py @@ -39,7 +39,7 @@ from taiga.projects.issues.models import * from taiga.projects.wiki.models import * from taiga.projects.attachments.models import * from taiga.projects.custom_attributes.models import * -from taiga.projects.custom_attributes.choices import TYPES_CHOICES, TEXT_TYPE, MULTILINE_TYPE, DATE_TYPE +from taiga.projects.custom_attributes.choices import TYPES_CHOICES, TEXT_TYPE, MULTILINE_TYPE, DATE_TYPE, URL_TYPE from taiga.projects.history.services import take_snapshot from taiga.projects.likes.services import add_like from taiga.projects.votes.services import add_vote @@ -92,6 +92,12 @@ SUBJECT_CHOICES = [ "Support for bulk actions", "Migrate to Python 3 and milk a beautiful cow"] +URL_CHOICES = [ + "https://taiga.io", + "https://blog.taiga.io", + "https://tree.taiga.io", + "https://tribe.taiga.io"] + BASE_USERS = getattr(settings, "SAMPLE_DATA_BASE_USERS", {}) NUM_USERS = getattr(settings, "SAMPLE_DATA_NUM_USERS", 10) NUM_INVITATIONS =getattr(settings, "SAMPLE_DATA_NUM_INVITATIONS", 2) @@ -279,6 +285,8 @@ class Command(BaseCommand): return self.sd.paragraphs(2, 4) if type == DATE_TYPE: return self.sd.future_date(min_distance=0, max_distance=365) + if type == DATE_URL: + return self.sd.choice(URL_CHOICES) return None def create_bug(self, project):