mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
feat: manual ordering for issues in kanban
This commit is contained in:
parent
7e92efee23
commit
c4fff45429
@ -40,12 +40,12 @@ class IssueFlatSerializer(BaseSerializer):
|
|||||||
"start_date",
|
"start_date",
|
||||||
"target_date",
|
"target_date",
|
||||||
"sequence_id",
|
"sequence_id",
|
||||||
|
"sort_order",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Issue Serializer with state details
|
# Issue Serializer with state details
|
||||||
class IssueStateSerializer(BaseSerializer):
|
class IssueStateSerializer(BaseSerializer):
|
||||||
|
|
||||||
state_detail = StateSerializer(read_only=True, source="state")
|
state_detail = StateSerializer(read_only=True, source="state")
|
||||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||||
|
|
||||||
@ -57,7 +57,6 @@ class IssueStateSerializer(BaseSerializer):
|
|||||||
##TODO: Find a better way to write this serializer
|
##TODO: Find a better way to write this serializer
|
||||||
## Find a better approach to save manytomany?
|
## Find a better approach to save manytomany?
|
||||||
class IssueCreateSerializer(BaseSerializer):
|
class IssueCreateSerializer(BaseSerializer):
|
||||||
|
|
||||||
state_detail = StateSerializer(read_only=True, source="state")
|
state_detail = StateSerializer(read_only=True, source="state")
|
||||||
created_by_detail = UserLiteSerializer(read_only=True, source="created_by")
|
created_by_detail = UserLiteSerializer(read_only=True, source="created_by")
|
||||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||||
@ -176,7 +175,6 @@ class IssueCreateSerializer(BaseSerializer):
|
|||||||
return issue
|
return issue
|
||||||
|
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
|
|
||||||
blockers = validated_data.pop("blockers_list", None)
|
blockers = validated_data.pop("blockers_list", None)
|
||||||
assignees = validated_data.pop("assignees_list", None)
|
assignees = validated_data.pop("assignees_list", None)
|
||||||
labels = validated_data.pop("labels_list", None)
|
labels = validated_data.pop("labels_list", None)
|
||||||
@ -254,7 +252,6 @@ class IssueCreateSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueActivitySerializer(BaseSerializer):
|
class IssueActivitySerializer(BaseSerializer):
|
||||||
|
|
||||||
actor_detail = UserLiteSerializer(read_only=True, source="actor")
|
actor_detail = UserLiteSerializer(read_only=True, source="actor")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -263,7 +260,6 @@ class IssueActivitySerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueCommentSerializer(BaseSerializer):
|
class IssueCommentSerializer(BaseSerializer):
|
||||||
|
|
||||||
actor_detail = UserLiteSerializer(read_only=True, source="actor")
|
actor_detail = UserLiteSerializer(read_only=True, source="actor")
|
||||||
issue_detail = IssueFlatSerializer(read_only=True, source="issue")
|
issue_detail = IssueFlatSerializer(read_only=True, source="issue")
|
||||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||||
@ -319,7 +315,6 @@ class LabelSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueLabelSerializer(BaseSerializer):
|
class IssueLabelSerializer(BaseSerializer):
|
||||||
|
|
||||||
# label_details = LabelSerializer(read_only=True, source="label")
|
# label_details = LabelSerializer(read_only=True, source="label")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -332,7 +327,6 @@ class IssueLabelSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class BlockedIssueSerializer(BaseSerializer):
|
class BlockedIssueSerializer(BaseSerializer):
|
||||||
|
|
||||||
blocked_issue_detail = IssueFlatSerializer(source="block", read_only=True)
|
blocked_issue_detail = IssueFlatSerializer(source="block", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -341,7 +335,6 @@ class BlockedIssueSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class BlockerIssueSerializer(BaseSerializer):
|
class BlockerIssueSerializer(BaseSerializer):
|
||||||
|
|
||||||
blocker_issue_detail = IssueFlatSerializer(source="blocked_by", read_only=True)
|
blocker_issue_detail = IssueFlatSerializer(source="blocked_by", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -350,7 +343,6 @@ class BlockerIssueSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueAssigneeSerializer(BaseSerializer):
|
class IssueAssigneeSerializer(BaseSerializer):
|
||||||
|
|
||||||
assignee_details = UserLiteSerializer(read_only=True, source="assignee")
|
assignee_details = UserLiteSerializer(read_only=True, source="assignee")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -373,7 +365,6 @@ class CycleBaseSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueCycleDetailSerializer(BaseSerializer):
|
class IssueCycleDetailSerializer(BaseSerializer):
|
||||||
|
|
||||||
cycle_detail = CycleBaseSerializer(read_only=True, source="cycle")
|
cycle_detail = CycleBaseSerializer(read_only=True, source="cycle")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -404,7 +395,6 @@ class ModuleBaseSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class IssueModuleDetailSerializer(BaseSerializer):
|
class IssueModuleDetailSerializer(BaseSerializer):
|
||||||
|
|
||||||
module_detail = ModuleBaseSerializer(read_only=True, source="module")
|
module_detail = ModuleBaseSerializer(read_only=True, source="module")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -9,6 +9,7 @@ from django.dispatch import receiver
|
|||||||
from . import ProjectBaseModel
|
from . import ProjectBaseModel
|
||||||
from plane.utils.html_processor import strip_tags
|
from plane.utils.html_processor import strip_tags
|
||||||
|
|
||||||
|
|
||||||
# TODO: Handle identifiers for Bulk Inserts - nk
|
# TODO: Handle identifiers for Bulk Inserts - nk
|
||||||
class Issue(ProjectBaseModel):
|
class Issue(ProjectBaseModel):
|
||||||
PRIORITY_CHOICES = (
|
PRIORITY_CHOICES = (
|
||||||
@ -56,6 +57,7 @@ class Issue(ProjectBaseModel):
|
|||||||
labels = models.ManyToManyField(
|
labels = models.ManyToManyField(
|
||||||
"db.Label", blank=True, related_name="labels", through="IssueLabel"
|
"db.Label", blank=True, related_name="labels", through="IssueLabel"
|
||||||
)
|
)
|
||||||
|
sort_order = models.FloatField(default=65535)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Issue"
|
verbose_name = "Issue"
|
||||||
@ -246,7 +248,6 @@ class IssueProperty(ProjectBaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Label(ProjectBaseModel):
|
class Label(ProjectBaseModel):
|
||||||
|
|
||||||
parent = models.ForeignKey(
|
parent = models.ForeignKey(
|
||||||
"self",
|
"self",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -269,7 +270,6 @@ class Label(ProjectBaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class IssueLabel(ProjectBaseModel):
|
class IssueLabel(ProjectBaseModel):
|
||||||
|
|
||||||
issue = models.ForeignKey(
|
issue = models.ForeignKey(
|
||||||
"db.Issue", on_delete=models.CASCADE, related_name="label_issue"
|
"db.Issue", on_delete=models.CASCADE, related_name="label_issue"
|
||||||
)
|
)
|
||||||
@ -288,7 +288,6 @@ class IssueLabel(ProjectBaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class IssueSequence(ProjectBaseModel):
|
class IssueSequence(ProjectBaseModel):
|
||||||
|
|
||||||
issue = models.ForeignKey(
|
issue = models.ForeignKey(
|
||||||
Issue, on_delete=models.SET_NULL, related_name="issue_sequence", null=True
|
Issue, on_delete=models.SET_NULL, related_name="issue_sequence", null=True
|
||||||
)
|
)
|
||||||
@ -305,7 +304,6 @@ class IssueSequence(ProjectBaseModel):
|
|||||||
# TODO: Find a better method to save the model
|
# TODO: Find a better method to save the model
|
||||||
@receiver(post_save, sender=Issue)
|
@receiver(post_save, sender=Issue)
|
||||||
def create_issue_sequence(sender, instance, created, **kwargs):
|
def create_issue_sequence(sender, instance, created, **kwargs):
|
||||||
|
|
||||||
if created:
|
if created:
|
||||||
IssueSequence.objects.create(
|
IssueSequence.objects.create(
|
||||||
issue=instance, sequence=instance.sequence_id, project=instance.project
|
issue=instance, sequence=instance.sequence_id, project=instance.project
|
||||||
|
Loading…
Reference in New Issue
Block a user