Login

Snippets by dannygale

Snippet List

Combined CreateView and UpdateView

By combining the CreateView and UpdateView, you can significantly reduce repetition when processing complex forms (for example, with multiple inline formsets), by only writing the get_context_data and form_valid functions once. This class can be used just like a normal CreateView or UpdateView. Note that if you're trying to use it as an UpdateView but it cannot find the requested object, it will behave as a CreateView, rather than showing a 404 page.

  • generic-view
  • class-based-generic-view
  • UpdateView
  • CreateView
Read More

dannygale has posted 1 snippet.