Add new custom attribute type: URL

remotes/origin/logger
Andrea Stagi 2016-01-26 20:36:06 +01:00 committed by David Barragán Merino
parent 7ec0ecfc33
commit 55a1a261f4
3 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@
## 2.0.0 ??? (unreleased) ## 2.0.0 ??? (unreleased)
### Features ### Features
- Ability to create url custom fields. (thanks to [@astagi](https://github.com/astagi)).
- Blocked projects support - Blocked projects support
- Transfer projects ownership support - Transfer projects ownership support
- Customizable max private and public projects per user - Customizable max private and public projects per user

View File

@ -21,9 +21,11 @@ from django.utils.translation import ugettext_lazy as _
TEXT_TYPE = "text" TEXT_TYPE = "text"
MULTILINE_TYPE = "multiline" MULTILINE_TYPE = "multiline"
DATE_TYPE = "date" DATE_TYPE = "date"
URL_TYPE = "url"
TYPES_CHOICES = ( TYPES_CHOICES = (
(TEXT_TYPE, _("Text")), (TEXT_TYPE, _("Text")),
(MULTILINE_TYPE, _("Multi-Line Text")), (MULTILINE_TYPE, _("Multi-Line Text")),
(DATE_TYPE, _("Date")) (DATE_TYPE, _("Date")),
(URL_TYPE, _("Url"))
) )

View File

@ -39,7 +39,7 @@ from taiga.projects.issues.models import *
from taiga.projects.wiki.models import * from taiga.projects.wiki.models import *
from taiga.projects.attachments.models import * from taiga.projects.attachments.models import *
from taiga.projects.custom_attributes.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.history.services import take_snapshot
from taiga.projects.likes.services import add_like from taiga.projects.likes.services import add_like
from taiga.projects.votes.services import add_vote from taiga.projects.votes.services import add_vote
@ -92,6 +92,12 @@ SUBJECT_CHOICES = [
"Support for bulk actions", "Support for bulk actions",
"Migrate to Python 3 and milk a beautiful cow"] "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", {}) BASE_USERS = getattr(settings, "SAMPLE_DATA_BASE_USERS", {})
NUM_USERS = getattr(settings, "SAMPLE_DATA_NUM_USERS", 10) NUM_USERS = getattr(settings, "SAMPLE_DATA_NUM_USERS", 10)
NUM_INVITATIONS =getattr(settings, "SAMPLE_DATA_NUM_INVITATIONS", 2) NUM_INVITATIONS =getattr(settings, "SAMPLE_DATA_NUM_INVITATIONS", 2)
@ -279,6 +285,8 @@ class Command(BaseCommand):
return self.sd.paragraphs(2, 4) return self.sd.paragraphs(2, 4)
if type == DATE_TYPE: if type == DATE_TYPE:
return self.sd.future_date(min_distance=0, max_distance=365) return self.sd.future_date(min_distance=0, max_distance=365)
if type == DATE_URL:
return self.sd.choice(URL_CHOICES)
return None return None
def create_bug(self, project): def create_bug(self, project):