Admin: remove .cast() calls and replace with select_subclasses()

This commit is contained in:
Jens Langhammer 2018-11-28 14:01:18 +01:00
parent 005d0f1c8f
commit bc65fae4b2

View file

@ -54,8 +54,7 @@ class SourceUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView):
return form_class
def get_object(self, queryset=None):
obj = Source.objects.get(pk=self.kwargs.get('pk'))
return obj.cast()
return Source.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first()
class SourceDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):
@ -67,5 +66,4 @@ class SourceDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):
success_message = _('Successfully updated Source')
def get_object(self, queryset=None):
obj = Source.objects.get(pk=self.kwargs.get('pk'))
return obj.cast()
return Source.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first()