示例#1
0
def by_id(request, pk):  # Просмотр фотографии с указанным id
    item = get_object_or_404(Photo.objects.filter(id=pk, user=request.user.id))
    if item:
        set_article_kind(request.user, app_name, '', item.id)
        set_article_visible(request.user, app_name, False)
        return HttpResponseRedirect(reverse('v2_photo:one'))
    return HttpResponseRedirect(reverse('v2_photo:main'))
示例#2
0
def wage_entity(request, name, pk):
    if (name == EMPL_LIST):
        set_restriction(request.user, app_name, EMPL_INFO)
    elif (name == DEP_LIST):
        set_restriction(request.user, app_name, DEP_HIST)
    else:
        set_restriction(request.user, app_name, name)
    set_article_kind(request.user, app_name, '', pk)
    return HttpResponseRedirect(reverse('v2_wage:main'))
示例#3
0
def item2_form(request, pk):
    app_param = get_app_params(request.user, app_name)
    if (app_param.restriction == EMPL_INFO):
        set_article_kind(request.user, app_name, '', pk)
    if (app_param.restriction == DEP_HIST):
        set_article_kind(request.user, app_name, '', pk)
        set_restriction(request.user, app_name, DEP_INFO)
    return HttpResponseRedirect(
        reverse('v2_wage:main') + extract_get_params(request))
示例#4
0
def one(request):  # Просмотр одной фотографии, заданной именем файла
    name = get_name_from_request(request)
    if name:
        dirs = name.split('/')
        sub_name = dirs[-1:][0]
        if (len(dirs) > 1):
            sub_path = name[:len(name) - len(sub_name) - 1]
        else:
            sub_path = ''
        pk = get_photo_id(request.user, sub_path, sub_name)
        if pk:
            set_article_kind(request.user, app_name, '', pk)
            set_article_visible(request.user, app_name, False)
            return HttpResponseRedirect(reverse('v2_photo:one'))
    app_param = get_app_params(request.user, app_name)
    return do_main(request, 'one', app_param.art_id)
示例#5
0
def item_form(request, pk):
    app_param = get_app_params(request.user, app_name)
    if (app_param.restriction == EMPL_LIST):
        set_restriction(request.user, app_name, EMPL_INFO)
        item = Employee.objects.filter(id=pk).get()
        item.set_active()
        set_article_kind(request.user, app_name, '', item.id)
    elif (app_param.restriction == DEP_LIST):
        set_restriction(request.user, app_name, DEP_HIST)
        item = Depart.objects.filter(id=pk).get()
        item.set_active()
        set_article_kind(request.user, app_name, '', item.id)
    elif (app_param.restriction == DEP_INFO):
        set_restriction(request.user, app_name, DEP_HIST)
        set_article_kind(request.user, app_name, '', pk)
    else:
        set_article_kind(request.user, app_name, '', pk)
    return HttpResponseRedirect(
        reverse('v2_wage:main') + extract_get_params(request))
示例#6
0
def add_employee(request):
    item = Employee.objects.create(user=request.user,
                                   fio=request.POST['item_add-name'])
    set_article_kind(request.user, app_name, '', item.id)
    return item.id
示例#7
0
def add_dep_hist(request, depart):
    item = DepHist.objects.create(depart=depart)
    set_article_kind(request.user, app_name, '', item.id)
    return item.id
示例#8
0
def trip_entity(request, name, pk):
    set_restriction(request.user, app_name, name)
    set_article_kind(request.user, app_name, '', pk)
    return HttpResponseRedirect(reverse('v2_trip:main'))
示例#9
0
def item_form(request, pk):
    set_article_kind(request.user, app_name, '', pk)
    return HttpResponseRedirect(
        reverse('v2_trip:main') + extract_get_params(request))