From a4f2493848209be742671d9328edc2274edc6404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 15 Jun 2016 17:13:00 +0200 Subject: [PATCH] Issue #3964: Order project templates --- CHANGELOG.md | 1 + .../fixtures/initial_project_templates.json | 2 ++ .../migrations/0048_auto_20160615_1508.py | 24 +++++++++++++++++++ taiga/projects/models.py | 4 +++- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 taiga/projects/migrations/0048_auto_20160615_1508.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 67c30c98..439d9bb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features - Include created, modified and finished dates for tasks in CSV reports. - Add gravatar url to Users API endpoint. +- ProjectTemplates now are sorted by the attribute 'order'. - Comments: - Now comment owners and project admins can edit existing comments with the history Entry endpoint. - Add a new permissions to allow add comments instead of use the existent modify permission for this purpose. diff --git a/taiga/projects/fixtures/initial_project_templates.json b/taiga/projects/fixtures/initial_project_templates.json index 54e73bd0..ea638da4 100644 --- a/taiga/projects/fixtures/initial_project_templates.json +++ b/taiga/projects/fixtures/initial_project_templates.json @@ -5,6 +5,7 @@ "fields": { "name": "Scrum", "slug": "scrum", + "order": 1, "description": "The agile product backlog in Scrum is a prioritized features list, containing short descriptions of all functionality desired in the product. When applying Scrum, it's not necessary to start a project with a lengthy, upfront effort to document all requirements. The Scrum product backlog is then allowed to grow and change as more is learned about the product and its customers", "created_date": "2014-04-22T14:48:43.596Z", "modified_date": "2014-07-25T10:02:46.479Z", @@ -32,6 +33,7 @@ "fields": { "name": "Kanban", "slug": "kanban", + "order": 2, "description": "Kanban is a method for managing knowledge work with an emphasis on just-in-time delivery while not overloading the team members. In this approach, the process, from definition of a task to its delivery to the customer, is displayed for participants to see and team members pull work from a queue.", "created_date": "2014-04-22T14:50:19.738Z", "modified_date": "2014-07-25T13:11:42.754Z", diff --git a/taiga/projects/migrations/0048_auto_20160615_1508.py b/taiga/projects/migrations/0048_auto_20160615_1508.py new file mode 100644 index 00000000..ab8ab0be --- /dev/null +++ b/taiga/projects/migrations/0048_auto_20160615_1508.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-06-15 15:08 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0047_auto_20160614_1201'), + ] + + operations = [ + migrations.AlterModelOptions( + name='projecttemplate', + options={'ordering': ['order', 'name'], 'verbose_name': 'project template', 'verbose_name_plural': 'project templates'}, + ), + migrations.AddField( + model_name='projecttemplate', + name='order', + field=models.IntegerField(default=10000, verbose_name='user order'), + ), + ] diff --git a/taiga/projects/models.py b/taiga/projects/models.py index 0c6bcc09..b0b790d4 100644 --- a/taiga/projects/models.py +++ b/taiga/projects/models.py @@ -717,6 +717,8 @@ class ProjectTemplate(models.Model): verbose_name=_("slug"), unique=True) description = models.TextField(null=False, blank=False, verbose_name=_("description")) + order = models.IntegerField(default=10000, null=False, blank=False, + verbose_name=_("user order")) created_date = models.DateTimeField(null=False, blank=False, verbose_name=_("created date"), default=timezone.now) @@ -754,7 +756,7 @@ class ProjectTemplate(models.Model): class Meta: verbose_name = "project template" verbose_name_plural = "project templates" - ordering = ["name"] + ordering = ["order", "name"] def __str__(self): return self.name