dev: back migration for project member views (#663)

This commit is contained in:
pablohashescobar 2023-04-04 00:00:03 +05:30 committed by GitHub
parent 1bb93f1f50
commit 588247f1c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 3 deletions

View File

@ -3,7 +3,8 @@ import uuid
import random
from django.contrib.auth.hashers import make_password
from plane.db.models import ProjectIdentifier
from plane.db.models import Issue, IssueComment, User, Project, Label
from plane.db.models import Issue, IssueComment, User, Project, ProjectMember
# Update description and description html values for old descriptions
@ -136,6 +137,30 @@ def update_project_cover_images():
print("Failed")
def update_user_view_property():
try:
project_members = ProjectMember.objects.all()
updated_project_members = []
for project_member in project_members:
project_member.default_props = {
"filters": {"type": None},
"orderBy": "-created_at",
"collapsed": True,
"issueView": "list",
"filterIssue": None,
"groupByProperty": True,
"showEmptyGroups": True,
}
updated_project_members.append(project_member)
ProjectMember.objects.bulk_update(
updated_project_members, ["default_props"], batch_size=100
)
print("Success")
except Exception as e:
print(e)
print("Failed")
def update_label_color():
try:
labels = Label.objects.filter(color="")

View File

@ -21,10 +21,13 @@ ROLE_CHOICES = (
def get_default_props():
return {
"filters": {"type": None},
"orderBy": "-created_at",
"collapsed": True,
"issueView": "list",
"groupByProperty": None,
"orderBy": None,
"filterIssue": None,
"groupByProperty": True,
"showEmptyGroups": True,
}