Esempio n. 1
0
def count_process(user):
    user_id = get_user_id(user)
    process_user_all_count = Intermediate.objects.filter(
        user=user_id, is_read=0, status=0).all().count()
    if not process_user_all_count:
        return ''
    return process_user_all_count
Esempio n. 2
0
def get_messages(user):
    html_a = '''
        <a href="/process/audit/info/?audit={id}">
            <span class="image"><img src="/{avatar}" alt="Profile Image" />{username}</span>
                <span>
                <span></span>
                <span class="time"></span>
                </span>
            <span class="message">
                待审核流程: {process_name}
            </span>
        </a>
        
        '''
    user_id = get_user_id(user)
    process_user_all = Intermediate.objects.filter(user=user_id,
                                                   is_read=0,
                                                   status=0).all()
    message = ''
    for i in process_user_all:
        # id = i.id
        # avatar = i.create_user.head_img
        # username = i.create_user.username
        # process_name = i.name
        i = html_a.format(id=i.id,
                          avatar=i.create_user.head_img,
                          username=i.create_user.username,
                          process_name=i.name)
        if message:
            message += i
        else:
            message = i

    return mark_safe(message)
Esempio n. 3
0
def create_project_dict(request,use='create'):
    project_dict = {}
    project_dict['title'] = request.POST.get('title')
    if use == 'create':
        project_dict['create_time'] = time.strftime('%Y-%m-%d %X')
    elif use == 'change':
        project_dict['change_time'] = time.strftime('%Y-%m-%d %X')
    project_dict['deploy_dir'] = request.POST.get('deploy_dir')
    project_dict['create_user_id'] = get_user_id(request.session['user'])
    project_dict['server_group_id'] = request.POST.get('server_group')
    project_dict['git_auth_way'] = request.POST.get('git_auth_way')
    project_dict['git_url'] = request.POST.get('git_url')
    project_dict['git_branch'] = request.POST.get('git_branch')
    project_dict['online_notice'] = request.POST.get('online_notice')
    project_dict['describe'] = request.POST.get('describe')
    git_user = request.POST.get('git_user')
    if git_user:
        project_dict['git_user'] = git_user
        project_dict['git_password'] = request.POST.get('git_passowrd')
    if request.POST.get('exclude_file'):
        project_dict['exclude_file'] = request.POST.get('exclude_file')
    if project_dict['online_notice'] == 'email':
        project_dict['email_notice_id'] = request.POST.get('email_notice')
    elif project_dict['online_notice'] == 'dingding':
        project_dict['dingding_notice'] = request.POST.get('dingding_notice')
    return project_dict
Esempio n. 4
0
def AddNavigation(request):
    if request.method == 'POST':
        navigation_dict = {}
        navigation_dict['name_id'] = get_user_id(request.session.get('user'))
        navigation_dict['website_name'] = request.POST.get('website_name')
        navigation_dict['website_url'] = request.POST.get('website_url')
        add_website = Navigation.objects.create(**navigation_dict)
        return redirect('/index/')
Esempio n. 5
0
def Index(request):
    if request.method == 'GET':
        user_id = get_user_id(request.session.get('user'))
        form = forms.AddNavigationForm()
        navigation_obj = Navigation.objects.filter(name=user_id).all()
        return render(request, 'index.html', {
            'form': form,
            'navigation_obj': navigation_obj
        })