This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
poetry run plum manage shell_plus | |
u = Member.objects.get(email='[email protected]') | |
u.set_password("123") | |
u.save() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function recursiveFind(array, key, value) { | |
var o; | |
array.some(function iter(a) { | |
if (a[key] === value) { | |
o = a; | |
return true; | |
} | |
return Array.isArray(a.children) && a.children.some(iter); | |
}); | |
return o; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { id, ...payload_without_id } = payload; | |
// use case | |
updateMilestone({ commit, state, getters }, payload) { | |
const { id, ...payload_without_id } = payload; | |
const url = `${base_url}api/milestones/${id}/`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<a-form-model ref="ruleForm" :model="milestone_data" :rules="rules"> | |
<a-form-model-item ref="name" label="Name" prop="name"> | |
<a-input v-model="milestone_data.name" /> | |
</a-form-model-item> | |
<a-form-model-item ref="start_date" label="Start Date" prop="start_date"> | |
<a-date-picker v-model="milestone_data.start_date" /> | |
</a-form-model-item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userReactionExist(alias) { | |
let user_id = 1; | |
let user_reaction = _.find(this.reactions, function (reaction) { | |
if (reaction.alias == alias) { | |
if (reaction.user.id == user_id) { | |
return true; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.isEqual(_.sortBy(array1), _.sortBy(array2)) | |
// example | |
validateArray(field_key) { | |
let original_array = this.pre_toggle_data[field_key]; | |
let new_array = this.task_data[field_key]; | |
// check contains the same value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mounted() { | |
// we can set auto focus | |
this.editor = new Editor({ | |
autoFocus: true | |
}); | |
// or we can focus programatically | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using lodash | |
_.map(assignees, "id"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start console | |
poetry run python manage.py shell | |
# import model | |
from plum.plum_project.models import Project | |
# list Model fields |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
poetry run python manage.py show_urls |