Skip to content

Instantly share code, notes, and snippets.

@fchevitarese
Created January 11, 2017 11:40
Show Gist options
  • Save fchevitarese/2c3fba7a61bdb2a020ada40ec4ff57fc to your computer and use it in GitHub Desktop.
Save fchevitarese/2c3fba7a61bdb2a020ada40ec4ff57fc to your computer and use it in GitHub Desktop.
indexView2.py
class indexView2(ListView):
queryset = Post.objects.order_by('-data')
template_name = "post_list.html"
paginate_by = 3
def form_valid(self, form):
# Faça sua lógica aqui
return super(DenunciaMixin, self).form_valid(form)
def get_context_data(self, **kwargs):
# Aqui você pode adicionar outras coisas no contexto.
context = super(indexView2, self).get_context_data(**kwargs)
context['form'] = ContatoForm
return context
def get_success_url(self, **kwargs):
return redirect(reverse('post_list'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment