Created
January 22, 2015 19:18
-
-
Save eugene-goldberg/c7ce60d0e3d847c2effc to your computer and use it in GitHub Desktop.
UpdateView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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