예제 #1
0
def create(request, evento):
    template = TEMPLATE % 'forms'
    form = InformeForm(request.POST or None,
                       request.FILES or None,
                       instance=None)
    if form.is_valid():
        informe = form.save(commit=False)
        informe.evento = evento
        informe.imagem = request.FILES.get('imagem', None)
        #if not form.cleaned_data['url'].strip():
        #    informe.url = slugify(informe.titulo)
        informe.save()
        portal_catalog_content.create(informe, CONTENT_TYPE)
        response = redirect('eventweb:index',
                            _evento=evento.url,
                            _content=informe.url)
        return response
    context = {
        'form': form,
        'content_type': CONTENT_TYPE,
        'page_header': 'Novo Informe',
        'subtext': '',
        'action': 'create',
        'evento': evento,
    }
    return render(request, template, context)
예제 #2
0
def create(request, evento, **kwargs):
    template = TEMPLATE % 'forms'
    form = MenuForm(request.POST or None, instance=None)
    pai = kwargs.get('pai', None)
    if form.is_valid():
        menu = form.save(commit=False)
        menu.evento = evento
        if pai:
            menu.menu_pai = pai
        #if not form.cleaned_data['url'].strip():
        #    menu.url = slugify(menu.titulo)
        menu.save()
        portal_catalog_content.create(menu, CONTENT_TYPE)
        if pai:
            return redirect('eventweb:index',
                            _evento=pai.evento.url,
                            _content=pai.url)
        return redirect('eventweb:index',
                        _evento=menu.evento.url,
                        _content=menu.url)
    context = {
        'form': form,
        'content_type': CONTENT_TYPE,
        'page_header': 'Novo Menu',
        'subtext': '',
        'action': 'create',
        'evento': evento,
    }
    return render(request, template, context)
예제 #3
0
def create(request, evento):
    template = TEMPLATE % 'forms'
    form = SessaoForm(request.POST or None, instance=None)
    if form.is_valid():
        sessao = form.save(commit=False)
        sessao.evento = evento
        sessao.save()
        portal_catalog_content.create(sessao, CONTENT_TYPE)
        return redirect('eventweb:index', _evento=sessao.evento.url, _content=sessao.url)
    context = {
        'form': form,
        'content_type': CONTENT_TYPE,
        'page_header': 'Nova Sessao',
        'subtext': '',
        'action': 'create',
        'evento': evento,
    }
    return render(request, template, context)
예제 #4
0
def create(request, evento):
    template = TEMPLATE % 'forms'
    form = LinkForm(request.POST or None, instance=None)
    if form.is_valid():
        link = form.save(commit=False)
        link.evento = evento
        #if not form.cleaned_data['url'].strip():
        #    link.url = slugify(link.titulo)
        link.save()
        portal_catalog_content.create(link, CONTENT_TYPE)
        response = redirect('eventweb:index', _evento=evento.url, _content=link.url)
        return response
    context={
        'form':form,
        'content_type':CONTENT_TYPE,
        'page_header':'Novo link',
        'subtext':'',
        'action':'create',
        'evento':evento,
    }
    return render(request, template, context)
예제 #5
0
def create(request, evento):
    template = TEMPLATE % 'forms'
    form = OrganizadorForm(request.POST or None, instance=None)
    if form.is_valid():
        organizador = form.save(commit=False)
        organizador.evento = evento
        #if not form.cleaned_data['url'].strip():
        #    organizador.url = slugify(organizador.titulo)
        organizador.save()
        portal_catalog_content.create(organizador, CONTENT_TYPE)
        return redirect('eventweb:index',
                        _evento=organizador.evento.url,
                        _content=organizador.url)
    context = {
        'form': form,
        'content_type': CONTENT_TYPE,
        'page_header': 'Novo organizador',
        'subtext': '',
        'action': 'create',
        'evento': evento,
    }
    return render(request, template, context)