Exemplo n.º 1
0
def create(request):
        system = request.session["system"]

        if systemDepth(System.objects.get(administrator__username=request.user.username)) >= 4:
            return HttpResponseForbidden(u"Você não tem permissão para criar um subsistema.")
        class ModifiedSettingsForm(SettingsForm):
            pass
                
        sysadm = User.objects.get(pk=request.user.id)
        settings_parent = Settings.objects.get(system=system)
        initial = {
            1:{'system':request.session['system']}
        }
        wiz = SystemWizard([UserCompleteFormAdmin,SystemForm,ModifiedSettingsForm],initial=initial)
        return wiz(context=RequestContext(request), request=request, extra_context=locals())
Exemplo n.º 2
0
def index(request):
    parent = []
    system = System.objects.get(administrator__username=request.user.username)
    
    parent = system.id
    vector = []
    if parent != []:
        childs = findChild(parent)
        vector.append(parent)
        vector.append(childs)
        
        vector_html = render_system_html2(childs)
    
    #controls the depth: systems that are deeper than 4 levels cannot create more subsystems
    if systemDepth(system) >= 4:
        can_create = 0
    else:
        can_create = 1
    
    return render_to_response("system/templates/home.html",locals())