Skip to content

Instantly share code, notes, and snippets.

@eugene-goldberg
Created January 22, 2015 19:18
Show Gist options
  • Save eugene-goldberg/c7ce60d0e3d847c2effc to your computer and use it in GitHub Desktop.
Save eugene-goldberg/c7ce60d0e3d847c2effc to your computer and use it in GitHub Desktop.
UpdateView
class UpdateView(forms.ModalFormView):
form_class = project_forms.UpdateWorkload
template_name = 'update_workload.html'
context_object_name = 'workload'
success_url = reverse_lazy('index')
def get_context_data(self, **kwargs):
context = super(UpdateView, self).get_context_data(**kwargs)
context["id"] = self.kwargs['id']
return context
@memoized.memoized_method
def _get_object(self, *args, **kwargs):
workload_id = self.kwargs['id']
try:
print workload_id
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve Workload.')
exceptions.handle(self.request, msg, redirect=redirect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment