예제 #1
0
파일: views.py 프로젝트: postgres/pgweb
def submitted_item_submitwithdraw(request, objtype, item, what):
    model = get_moderation_model_from_suburl(objtype)

    obj = get_object_or_404(model, pk=item)
    if not obj.verify_submitter(request.user):
        raise PermissionDenied("You are not the owner of this item!")

    if what == 'submit':
        return _submitted_item_submit(request, objtype, model, obj)
    else:
        return _submitted_item_withdraw(request, objtype, model, obj)
예제 #2
0
def submitted_item_form(request, objtype, item):
    model = get_moderation_model_from_suburl(objtype)

    if item == 'new':
        extracontext = {}
    else:
        extracontext = {
            'notices': ModerationNotification.objects.filter(
                objecttype=model.__name__,
                objectid=item,
            ).order_by('-date')
        }

    return simple_form(model, item, request, model.get_formclass(),
                       redirect='/account/edit/{}/'.format(objtype),
                       formtemplate='account/submit_form.html',
                       extracontext=extracontext)