

def post(self, request, *args, **kwargs):
    form = self.get_form()
    if form.is_valid():
        try:
            return self.form_valid(form)
        except IntegrityError as e:
            context = self.get_context_data()
            context['form'] = form
            form.add_error(None, e.args[1])
            return self.render_to_response(context)
    else:
        return self.form_invalid(form)

dataset/ETHPy150Open allegro/ralph/src/ralph/admin/views/multiadd.py MultiAddView.post/original