Task #3531: Add is_featured field to project model
parent
305cb5cd61
commit
806821469b
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue