diff --git a/taiga/projects/admin.py b/taiga/projects/admin.py index 7a65d6e2..d79da23c 100644 --- a/taiga/projects/admin.py +++ b/taiga/projects/admin.py @@ -66,9 +66,11 @@ class MembershipInline(admin.TabularInline): class ProjectAdmin(admin.ModelAdmin): - list_display = ["name", "owner", "created_date", "total_milestones", - "total_story_points"] - list_display_links = list_display + list_display = ["id", "name", "slug", "is_private", "is_featured", "owner", "created_date"] + list_display_links = ["id", "name", "slug"] + list_filter = ("is_private", "is_featured") + list_editable = ["is_featured"] + search_fields = ["id", "name", "slug", "owner__username", "owner__email", "owner__full_name"] inlines = [RoleInline, MembershipInline, MilestoneInline, NotifyPolicyInline, LikeInline] def get_object(self, *args, **kwargs): diff --git a/taiga/projects/api.py b/taiga/projects/api.py index 3146b51a..8fe30955 100644 --- a/taiga/projects/api.py +++ b/taiga/projects/api.py @@ -278,6 +278,7 @@ class ProjectWatchersViewSet(WatchersViewSetMixin, ModelListViewSet): permission_classes = (permissions.ProjectWatchersPermission,) resource_model = models.Project + ###################################################### ## Custom values for selectors ###################################################### @@ -295,6 +296,7 @@ class PointsViewSet(MoveOnDestroyMixin, ModelCrudViewSet, BulkUpdateOrderMixin): move_on_destroy_related_field = "points" move_on_destroy_project_default_field = "default_points" + class UserStoryStatusViewSet(MoveOnDestroyMixin, ModelCrudViewSet, BulkUpdateOrderMixin): model = models.UserStoryStatus serializer_class = serializers.UserStoryStatusSerializer diff --git a/taiga/projects/management/commands/sample_data.py b/taiga/projects/management/commands/sample_data.py index a8acaf04..bd898d2b 100644 --- a/taiga/projects/management/commands/sample_data.py +++ b/taiga/projects/management/commands/sample_data.py @@ -107,6 +107,9 @@ NUM_ATTACHMENTS = getattr(settings, "SAMPLE_DATA_NUM_ATTACHMENTS", (0, 4)) NUM_LIKES = getattr(settings, "SAMPLE_DATA_NUM_LIKES", (0, 10)) NUM_VOTES = getattr(settings, "SAMPLE_DATA_NUM_VOTES", (0, 10)) NUM_WATCHERS = getattr(settings, "SAMPLE_DATA_NUM_PROJECT_WATCHERS", (0, 8)) +FEATURED_PROJECTS_POSITIONS = [0, 1, 2] +LOOKING_FOR_PEOPLE_PROJECTS_POSITIONS = [0, 1, 2] + class Command(BaseCommand): sd = SampleDataHelper(seed=12345678901) @@ -230,6 +233,7 @@ class Command(BaseCommand): self.create_likes(project) + def create_attachment(self, obj, order): attached_file = self.sd.file_from_directory(*ATTACHMENT_SAMPLE_DATA) membership = self.sd.db_object_from_queryset(obj.project.memberships @@ -458,7 +462,9 @@ class Command(BaseCommand): public_permissions=public_permissions, total_story_points=self.sd.int(600, 3000), total_milestones=self.sd.int(5,10), - tags=self.sd.words(1, 10).split(" ")) + tags=self.sd.words(1, 10).split(" "), + is_looking_for_people=counter in LOOKING_FOR_PEOPLE_PROJECTS_POSITIONS, + is_featured=cointer in FEATURED_PROJECTS_POSITIONS) project.is_kanban_activated = True project.save() diff --git a/taiga/projects/migrations/0028_project_is_featured.py b/taiga/projects/migrations/0028_project_is_featured.py new file mode 100644 index 00000000..24401d6d --- /dev/null +++ b/taiga/projects/migrations/0028_project_is_featured.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0027_auto_20150916_1302'), + ] + + operations = [ + migrations.AddField( + model_name='project', + name='is_featured', + field=models.BooleanField(verbose_name='is featured', default=False), + ), + ] diff --git a/taiga/projects/models.py b/taiga/projects/models.py index e06c774c..c8884f79 100644 --- a/taiga/projects/models.py +++ b/taiga/projects/models.py @@ -169,6 +169,7 @@ class Project(ProjectDefaults, TaggedMixin, models.Model): related_name="projects", null=True, blank=True, default=None, verbose_name=_("creation template")) + anon_permissions = TextArrayField(blank=True, null=True, default=[], verbose_name=_("anonymous permissions"), @@ -180,6 +181,9 @@ class Project(ProjectDefaults, TaggedMixin, models.Model): is_private = models.BooleanField(default=True, null=False, blank=True, verbose_name=_("is private")) + is_featured = models.BooleanField(default=False, null=False, blank=True, + verbose_name=_("is featured")) + userstories_csv_uuid = models.CharField(max_length=32, editable=False, null=True, blank=True, default=None, db_index=True) @@ -189,7 +193,8 @@ class Project(ProjectDefaults, TaggedMixin, models.Model): null=True, blank=True, default=None, db_index=True) - tags_colors = TextArrayField(dimension=2, null=False, blank=True, verbose_name=_("tags colors"), default=[]) + tags_colors = TextArrayField(dimension=2, default=[], null=False, blank=True, + verbose_name=_("tags colors")) _importing = None class Meta: