-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
326 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.contrib import admin | ||
from .models import Context | ||
|
||
# Register your models here. | ||
class ContextAdmin(admin.ModelAdmin): | ||
list_display = ("id", "key", "value", "created_at", "updated_at") | ||
search_fields = ("key", "value") | ||
list_filter = ("key", ) | ||
|
||
|
||
admin.site.register(Context, ContextAdmin) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class MetaConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'itsm.meta' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 3.2.25 on 2024-12-05 17:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Context', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('key', models.CharField(max_length=255, unique=True)), | ||
('value', models.TextField(blank=True)), | ||
], | ||
options={ | ||
'db_table': 'meta_context', | ||
}, | ||
), | ||
] |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.core.cache import cache | ||
from django.db import models | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
|
||
|
||
class Context(models.Model): | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
key = models.CharField(max_length=255, unique=True) | ||
value = models.TextField(blank=True) | ||
|
||
def __str__(self): | ||
return self.key | ||
|
||
class Meta: | ||
db_table = "meta_context" | ||
|
||
|
||
@receiver(post_save, sender=Context) | ||
def update_cache(sender, instance, **kwargs): | ||
cache_key = f'meta_context_{instance.key}' | ||
cache.set(cache_key, instance.value, 30) | ||
|
||
|
||
class ContextService: | ||
@staticmethod | ||
def get_context_value(key): | ||
cache_key = f'meta_context_{key}' | ||
context_value = cache.get(cache_key) | ||
if not context_value: | ||
try: | ||
context_value = Context.objects.get(key=key).value | ||
except Context.DoesNotExist: | ||
context_value = "" | ||
cache.set(cache_key, context_value, 30) | ||
return context_value | ||
|
||
@staticmethod | ||
def get_context_value_list(key): | ||
context_value = ContextService.get_context_value(key) | ||
context_value = [item.strip() for item in context_value.split(",")] if context_value else [] | ||
return context_value |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 3.2.25 on 2024-11-15 15:15 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('postman', '0010_auto_20210621_1206'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelManagers( | ||
name='remoteapi', | ||
managers=[ | ||
], | ||
), | ||
migrations.AlterModelManagers( | ||
name='remoteapiinstance', | ||
managers=[ | ||
], | ||
), | ||
migrations.AlterModelManagers( | ||
name='remotesystem', | ||
managers=[ | ||
], | ||
), | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 3.2.25 on 2024-11-15 15:15 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('task', '0028_auto_20210226_1745'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='task', | ||
name='processors_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='处理人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='taskfield', | ||
name='source_type', | ||
field=models.CharField(choices=[('CUSTOM', '自定义数据'), ('API', '接口数据'), ('DATADICT', '数据字典'), ('RPC', '系统数据'), ('CUSTOM_API', '自定义API')], default='CUSTOM', max_length=32, verbose_name='数据来源类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='taskfield', | ||
name='type', | ||
field=models.CharField(choices=[('STRING', '单行文本'), ('TEXT', '多行文本'), ('INT', '数字'), ('DATE', '日期'), ('DATETIME', '日期时间'), ('DATETIMERANGE', '时间间隔'), ('TABLE', '表格'), ('SELECT', '单选下拉框'), ('INPUTSELECT', '可输入单选下拉框'), ('MULTISELECT', '多选下拉框'), ('CHECKBOX', '复选框'), ('RADIO', '单选框'), ('MEMBER', '单个人员选择'), ('MEMBERS', '多个人员选择'), ('RICHTEXT', '富文本'), ('FILE', '附件上传'), ('CUSTOMTABLE', '自定义表格'), ('TREESELECT', '树形选择'), ('LINK', '链接'), ('CUSTOM-FORM', '自定义表单'), ('CASCADE', '级联')], default='STRING', max_length=32, verbose_name='字段类型'), | ||
), | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Generated by Django 3.2.25 on 2024-11-15 15:15 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.manager | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ticket', '0072_auto_20240513_1608'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelManagers( | ||
name='ticketfollowernotifylog', | ||
managers=[ | ||
('_objects', django.db.models.manager.Manager()), | ||
], | ||
), | ||
migrations.AlterField( | ||
model_name='status', | ||
name='assignors_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='派单人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='status', | ||
name='delivers_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='转单人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='status', | ||
name='processors_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='处理人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='taskfield', | ||
name='type', | ||
field=models.CharField(choices=[('STRING', '单行文本'), ('TEXT', '多行文本'), ('INT', '数字'), ('DATE', '日期'), ('DATETIME', '日期时间'), ('DATETIMERANGE', '时间间隔'), ('TABLE', '表格'), ('SELECT', '单选下拉框'), ('INPUTSELECT', '可输入单选下拉框'), ('MULTISELECT', '多选下拉框'), ('CHECKBOX', '复选框'), ('RADIO', '单选框'), ('MEMBER', '单个人员选择'), ('MEMBERS', '多个人员选择'), ('RICHTEXT', '富文本'), ('FILE', '附件上传'), ('CUSTOMTABLE', '自定义表格'), ('TREESELECT', '树形选择'), ('LINK', '链接'), ('CUSTOM-FORM', '自定义表单'), ('CASCADE', '级联')], default='STRING', max_length=32, verbose_name='字段类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticket', | ||
name='current_assignor_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='分派人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticket', | ||
name='current_processors_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='处理者类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticket', | ||
name='supervise_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='督办人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticketeventlog', | ||
name='processors_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='OPEN', max_length=32, verbose_name='处理人类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticketfield', | ||
name='type', | ||
field=models.CharField(choices=[('STRING', '单行文本'), ('TEXT', '多行文本'), ('INT', '数字'), ('DATE', '日期'), ('DATETIME', '日期时间'), ('DATETIMERANGE', '时间间隔'), ('TABLE', '表格'), ('SELECT', '单选下拉框'), ('INPUTSELECT', '可输入单选下拉框'), ('MULTISELECT', '多选下拉框'), ('CHECKBOX', '复选框'), ('RADIO', '单选框'), ('MEMBER', '单个人员选择'), ('MEMBERS', '多个人员选择'), ('RICHTEXT', '富文本'), ('FILE', '附件上传'), ('CUSTOMTABLE', '自定义表格'), ('TREESELECT', '树形选择'), ('LINK', '链接'), ('CUSTOM-FORM', '自定义表单'), ('CASCADE', '级联')], default='STRING', max_length=32, verbose_name='字段类型'), | ||
), | ||
migrations.AlterField( | ||
model_name='ticketfollowernotifylog', | ||
name='followers_type', | ||
field=models.CharField(choices=[('CMDB', 'CMDB业务公用角色'), ('GENERAL', '通用角色表'), ('OPEN', '不限'), ('PERSON', '个人'), ('STARTER', '提单人'), ('STARTER_LEADER', '提单人上级'), ('ASSIGN_LEADER', '指定节点处理人上级'), ('BY_ASSIGNOR', '派单人指定'), ('EMPTY', '无'), ('ORGANIZATION', '组织架构'), ('VARIABLE', '引用变量'), ('VARIABLE_LEADER', '指定变量上级'), ('IAM', '权限中心角色')], default='EMPTY', max_length=32, verbose_name='处理者类型/角色类型'), | ||
), | ||
] |
Oops, something went wrong.