def form_valid(self, form, **kwargs): self.response = ModalResponse('Амжилттай хадгалагдлаа', 'success') form.save() self.save(form) self.response = ModalResponse( "{obj} is created".format(obj=self.object), 'success') return super(BagtsView, self).form_valid(form, commit=False, **kwargs)
def form_valid(self, form, **kwargs): #import ipdb; ipdb.set_trace() # i = self.save(form, commit=False) # When you save the form an attribute name object is created. i = form.save() self.response = ModalResponse( "{obj} se agregó correctamente".format(obj=i), 'success') return super(PersonaCreateModal, self).form_valid(form, **kwargs)
def form_valid(self, form, **kwargs): i = form.save() self.response = ModalResponse( "{obj} se actualizó correctamente".format(obj=i), 'success') return super(PersonaUpdateModal, self).form_valid(form, commit=False, **kwargs)
def form_valid(self, form, **kwargs): self.save(form) self.response = ModalResponse( "{obj} амжилттай шинэчлэгдлээ".format(obj=self.object), 'success') return super(MyModalUpdate, self).form_valid(form, commit=False, **kwargs)
def form_valid(self, form, **kwargs): self.response = ModalResponse('Таны мэйл амжилттай илгээгдлээ', 'success') subject = 'no reply' message = form.cleaned_data['feedback'] user = SystemUser.objects.get(id=self.kwargs.pop('user_id', None)) video = Surgalt.objects.get(id=self.kwargs.pop('video_id', None)) message += user.email try: email = EmailMessage(subject, message, to=[video.author_email]) email.send() except BadHeaderError: return HttpResponse('Амжилтгүй') return super(LessonMailView, self).form_valid(form, **kwargs)
def form_valid(self, form): object = form.save(commit=False) if SystemUser.objects.filter(username = self.request.user.username) and \ Competition.objects.filter(id =self.kwargs['id']): object.user = SystemUser.objects.get( username=self.request.user.username) object.competition = Competition.objects.get( id=self.kwargs.pop('id', None)) object.auto_increment() object.save() self.response = ModalResponse('Амжилттай хадгалагдлаа', 'success') return super(WebCompetitionRegisterView, self).form_valid(form) else: return super(WebCompetitionRegisterView, self).form_invalid(form)
def form_valid(self, form, **kwargs): i = form.save() self.response = ModalResponse( "{obj} se agregó correctamente".format(obj=i), 'success') return super(CapitalHumanoCreateModal, self).form_valid(form, **kwargs)
def form_valid(self, form, **kwargs): self.response = ModalResponse("Good game", "success") return super(caozuopiaoCreateModalView, self).form_valid(form, **kwargs)