Skip to content

Instantly share code, notes, and snippets.

@fitoria
Created September 3, 2012 05:08
Show Gist options
  • Save fitoria/3606842 to your computer and use it in GitHub Desktop.
Save fitoria/3606842 to your computer and use it in GitHub Desktop.
class AfiliacionNacionalCreateView(CreateView):
model = AfiliacionNacional
form_class = AfiliacionNacionalForm
success_url = reverse_lazy('afiliacionnacional-list')
def form_valid(self, form):
messages.info(self.request, 'Afiliacion creado', extra_tags='alert alert-success')
return super(AfiliacionNacionalCreateView, self).form_valid(form)
class AfiliacionNacionalDeleteView(DeleteView):
model = AfiliacionNacional
success_url = reverse_lazy('afiliacionnacional-list')
def post(self, *args, **kwargs):
messages.info(self.request, 'Afiliacion ha sido borrada', extra_tags='alert alert-success')
return super(AfiliacionNacionalDeleteView, self).post(*args, **kwargs)
class AfiliacionNacionalUpdateView(UpdateView):
model = AfiliacionNacional
form_class = AfiliacionNacionalForm
success_url = reverse_lazy('afiliacionnacional-list')
def form_valid(self, form):
messages.info(self.request, 'Afiliacion editada con éxito', extra_tags='alert alert-success')
return super(AfiliacionNacionalUpdateView, self).form_valid(form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment