コード例 #1
0
    def form_valid(self, form):
        profile = self.request.user.get_profile()
        title = form.cleaned_data['title']
        text = form.cleaned_data['text']

        if self.current_question:
            profile.edit_question(
                question=self.current_question.thread.question,
                title=title,
                body_text=text,
                revision_comment="support edition",
                tags=self.get_cleaned_tags(self.request))

        else:
            post = profile.post_question(
                language_code=translation.get_language(),
                site=Site.objects.get_current(),
                title=title,
                body_text=text,
                tags=self.get_cleaned_tags(self.request),
                timestamp=datetime.now())
            form.instance.thread = post.thread
            form.save()
            post.thread.is_specific = self.is_specific
            post.thread.save()

        return FormView.form_valid(self, form)
コード例 #2
0
ファイル: peopleViews.py プロジェクト: rafasis1986/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name']
     surname = form.cleaned_data['surname']
     profetionPk = form.cleaned_data['profetion']
     profetion = Profetion.objects.get(pk=profetionPk)
     People.objects.get(pk=self.kwargs['slug']).update(name=name, surname=surname, profetion=profetion)
     return FormView.form_valid(self, form)
コード例 #3
0
    def form_valid(self, form):
        displayInConsole(self)

        result = AnswerResult.create(self.currentProcess, self.QA,
                                     form.instance.answer)

        return FormView.form_valid(self, form)
コード例 #4
0
    def form_valid(self, form):
        """Mark the first wizard step as done, save value and redirect."""
        first_boot.mark_step_done('router_setup_wizard')
        if 'skip' in form.data:
            return FormView.form_valid(self, form)

        return super().form_valid(form)
コード例 #5
0
    def form_valid(self, form):
        """Mark the first wizard step as done, save value and redirect."""
        first_boot.mark_step_done('internet_connectivity_type_wizard')
        if 'skip' in form.data:
            return FormView.form_valid(self, form)

        return super().form_valid(form)
コード例 #6
0
ファイル: views.py プロジェクト: Gnuside/imaginationforpeople
 def form_valid(self, form):
     profile = self.request.user.get_profile()
     title = form.cleaned_data['title']
     text = form.cleaned_data['text']
     
     if self.current_question:
         profile.edit_question(
             question=self.current_question.thread.question,
             title=title,
             body_text=text,
             revision_comment="support edition",
             tags=self.get_cleaned_tags(self.request)
         )
         
     else :
         post = profile.post_question(
             language_code=translation.get_language(),
             site=Site.objects.get_current(),
             title=title,
             body_text=text,
             tags=self.get_cleaned_tags(self.request),
             timestamp=datetime.now()
         )
         form.instance.thread = post.thread
         form.save()
         post.thread.is_specific = self.is_specific
         post.thread.save()
         
     return FormView.form_valid(self, form)
コード例 #7
0
    def form_valid(self, form):
        """Apply the form changes."""
        old_status = form.initial
        new_status = form.cleaned_data

        if old_status['auto_upgrades_enabled'] \
           != new_status['auto_upgrades_enabled']:

            try:
                if new_status['auto_upgrades_enabled']:
                    upgrades.enable()
                else:
                    upgrades.disable()
            except ActionError as exception:
                error = exception.args[2]
                messages.error(
                    self.request,
                    _('Error when configuring unattended-upgrades: {error}').
                    format(error=error))

            if new_status['auto_upgrades_enabled']:
                messages.success(self.request, _('Automatic upgrades enabled'))
            else:
                messages.success(self.request,
                                 _('Automatic upgrades disabled'))
        else:
            messages.info(self.request, _('Settings unchanged'))

        return FormView.form_valid(self, form)
コード例 #8
0
ファイル: profetionViews.py プロジェクト: rtorresve/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name'].strip().upper()
     try:
         Profetion.objects.get(pk=self.kwargs['slug']).update(name=name)
     except NotUniqueError:
         messages.error(self.request, "previously added profession")
         return FormView.form_invalid(self, form)
     return FormView.form_valid(self, form)
コード例 #9
0
ファイル: peopleViews.py プロジェクト: rafasis1986/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name']
     surname = form.cleaned_data['surname']
     profetionPk = form.cleaned_data['profetion']
     profetion = Profetion.objects.get(pk=profetionPk)
     person = People(name=name, surname=surname, profetion=profetion)
     person.save()
     return FormView.form_valid(self, form)
コード例 #10
0
ファイル: peopleViews.py プロジェクト: rtorresve/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name']
     surname = form.cleaned_data['surname']
     profetionPk = form.cleaned_data['profetion']
     profetion = Profetion.objects.get(pk=profetionPk)
     person = People(name=name, surname=surname, profetion=profetion)
     person.save()
     return FormView.form_valid(self, form)
コード例 #11
0
ファイル: peopleViews.py プロジェクト: rtorresve/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name']
     surname = form.cleaned_data['surname']
     profetionPk = form.cleaned_data['profetion']
     profetion = Profetion.objects.get(pk=profetionPk)
     People.objects.get(pk=self.kwargs['slug']).update(name=name,
                                                       surname=surname,
                                                       profetion=profetion)
     return FormView.form_valid(self, form)
コード例 #12
0
ファイル: profetionViews.py プロジェクト: rtorresve/pitmongo
 def form_valid(self, form):
     name = form.cleaned_data['name']
     profetion = Profetion(name=name)
     try:
         profetion.save()
     except NotUniqueError:
         messages.error(self.request, "previously added profession")
         return FormView.form_invalid(self, form)
     return FormView.form_valid(self, form)
コード例 #13
0
    def form_valid(self, form):
        fc = FileControl()
        imgfile = form.cleaned_data["image"]
        file_id = fc.save(imgfile)

        self.success_url = reverse("confirm_registration_document",
                                   kwargs={"file_id": file_id})

        return FormView.form_valid(self, form)
コード例 #14
0
ファイル: personal_info.py プロジェクト: simran-sr/onboarding
 def form_valid(self, form):
     id = self.kwargs['id']
     instance = ModelEmployee.objects.get(uuid=id)
     data = form.save(commit=False)
     data.employee = instance
     data.save()
     self.update_redirect_table()
     ModelEmployee.objects.filter(uuid=id).update(slug="personal")
     return FormView.form_valid(self, form)
コード例 #15
0
ファイル: document_info.py プロジェクト: simran-sr/onboarding
 def form_valid(self, form, **kwargs):
     id = self.kwargs['id']
     for file in self.request.FILES.getlist("files"):
         instance = ModelEmployee.objects.get(uuid=id)
         n = ModelDocumentGathering.objects.create(file=file,
                                                   employee=instance)
         n.save()
     self.update_redirect_table()
     ModelEmployee.objects.filter(uuid=id).update(slug="document")
     return FormView.form_valid(self, form)
コード例 #16
0
 def form_valid(self, form):
     try:
         form.send_email()
         message = u'Повідомлення успішно надіслане'            
         messages.success(self.request, message)
     except Exception:
         message = u'Під час відправки листа виникла непередбачувальна помилка. \
                     Спробуйте скористатися формою пізніше.'
         messages.error(self.request, message)
     return FormView.form_valid(self, form)
コード例 #17
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
 def form_valid(self, form):
     data = form.cleaned_data
     post = BlogPost(title=data['title'],
                     author=self.request.user,
                     tags=data['tags'],
                     abstract=data['abstract'],
                     text=data['text'],
                     priority=data['priority'])
     _handle_status(self.request, post, data['action'])
     post.save()
     return FormView.form_valid(self, form)
コード例 #18
0
ファイル: views.py プロジェクト: ccnmtl/wardenclyffe
    def form_valid(self, form):
        # This method is called when valid form data has been POSTed.
        collection = form.cleaned_data['collection']
        folder_id = form.cleaned_data['folder_id']

        for video in collection.video_set.all():
            if not video.has_panopto_source():
                submit_video_to_panopto(self.request.user, video, folder_id,
                                        form.cleaned_data['viewed'])

        return FormView.form_valid(self, form)
コード例 #19
0
ファイル: views.py プロジェクト: ccnmtl/wardenclyffe
    def form_valid(self, form):
        video = self.get_video()
        submit_video_to_panopto(
            self.request.user, video,
            form.cleaned_data['folder_id'])

        messages.add_message(
            self.request, messages.INFO,
            '{} was submitted to Panopto.'.format(video.title))

        return FormView.form_valid(self, form)
コード例 #20
0
 def form_valid(self, form):
     form.save()
     send_mail('emails/solution_created.html', {
         'solution_name': form.instance.solution_name,
         'solution_platform': form.instance.solution_platform,
         'solution_contact': form.instance.solution_contact_phone,
         'solution_deadline': form.instance.solution_deadline,
         'solution_budget': form.instance.solution_budget ,
         'solution_description': form.instance.solution_description
     }, '*****@*****.**', [form.instance.solution_contact_email, '*****@*****.**'])
     return FormView.form_valid(self, form)
コード例 #21
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
    def form_valid(self, form):
        data = form.cleaned_data

        thread = Thread(title=data['title'])
        thread.save()

        message = Message(author=self.request.user, thread=thread, text=data['text'])
        message.save()

        self.thread = thread  # For success url

        return FormView.form_valid(self, form)
コード例 #22
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
 def form_valid(self, form):
     data = form.cleaned_data
     self.message.modify(self.request.user, data['text'])
     if self.request.user.has_perm('board.can_moderate') and ('moderated' in data):
         if data['moderated']:
             self.message.moderated = True
             notify.board_post_moderate(self.request.user, self.message)
             messages.warning(self.request, "Le message a été modéré.")
         else:
             self.message.moderated = False
         self.message.save()
     messages.success(self.request, "Le message a été modifié.")
     return FormView.form_valid(self, form)
コード例 #23
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
    def form_valid(self, form):
        # Raise 404 if post does not exist
        post = get_object_or_404(BlogPost, pk=self.kwargs['pk'])
        if not post.can_be_viewed_by(self.request.user):
            # Raise 404, do not expose that this id exists with 403
            raise Http404

        data = form.cleaned_data
        post = BlogPost.objects.get(pk=self.kwargs['pk'])
        post.title = data['title']
        post.tags = data['tags']
        post.abstract = data['abstract']
        post.text = data['text']
        post.priority = data['priority']
        _handle_status(self.request, post, data['action'])

        return FormView.form_valid(self, form)
コード例 #24
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
    def form_valid(self, form):
        data = form.cleaned_data
        # Create thread
        thread = Thread(title=data['title'])
        thread.save()

        # Post message
        message = Message(author=self.request.user, thread=thread, text=data['text'])
        message.save()

        # Create link with blogpost
        link = BlogBoardLink(thread=thread, post=self.blogpost)
        link.save()

        # We'll need this in get_succes_url()
        self.thread = thread

        return FormView.form_valid(self, form)
コード例 #25
0
ファイル: views.py プロジェクト: suhasul/django10
 def from_valid(self, form):
     obj = form.save(commit=False)  # obj : Post 객체 (데이터베이스에 저장 X)
     obj.author = self.request.user  # 유저 정보 채우기
     obj.save()                      # 데이터베이스에 Post 객체 저장
     
     # 사용자가 저장 요청한 이미지 파일, 파일을 객체로 만들어 저장
     # <form> 태그 중 name이 'images'인 파일 데이터를 추출하는 방식
     for f in self.request.FILES.getlist('images'):
         images = PostImage(post=obj, image=f)
         # image = PostImage()
         # image.post = obj
         # image.image = f
         images.save()
     for f in self.request.FILES.getlist('files'):
         file = PostFile(post=obj, file=f)
         file.save()
         
     return HttpResponseRedirect( reverse('blog:detail', args=(obj.id, )))    
     
     return FormView.form_valid(self, form)
コード例 #26
0
ファイル: views.py プロジェクト: jordanorc/iaae
    def form_valid(self, form):
        cleaned_data = form.cleaned_data
        
        emails = cleaned_data['emails']
        tag = int(cleaned_data['tag'])
        
        for email in emails:
            email.mark(tag)
        
        if tag == EMAIL_TAGS.TRASH:
            messages.success(self.request, _(u'The message has been moved to the Trash.'))

        elif tag == EMAIL_TAGS.SPAM:
            messages.success(self.request, _(u'The message has been marked as spam.'))
            
        elif tag == EMAIL_TAGS.READ:
            messages.success(self.request, _(u'The message has been marked as read.'))
            
        elif tag == EMAIL_TAGS.IMPORTANT:
            messages.success(self.request, _(u'The message has been marked as important.'))
        
        return FormView.form_valid(self, form)
コード例 #27
0
ファイル: views.py プロジェクト: Harivishnu/cir-portal
 def form_valid(self, form):
     form.instance.aums_id = form.instance.aums_id.lower()
     form.save()
     return FormView.form_valid(self, form)
コード例 #28
0
 def form_valid(self, form):
     retval_redir = self._form_valid_redirect(form)
     retval = FormView.form_valid(self, form)
     if retval_redir is not None:
         return retval_redir
     return retval
コード例 #29
0
ファイル: views.py プロジェクト: FoxQQ/django_timewriting
 def form_valid(self, form):
     print(form)
     return FormView.form_valid(self, form)
コード例 #30
0
 def form_valid(self, form):
     form.instance.aums_id = form.instance.aums_id.lower()
     form.save()
     return FormView.form_valid(self, form)
コード例 #31
0
    def form_valid(self, form):
        obj = form.save(False)
        obj.question_id = self.kwargs['question_id']
        obj.save()

        return FormView.form_valid(self, form)
コード例 #32
0
 def form_valid(self, form):
     print("here")
     self.fc.store(self.kwargs["file_id"])
     return FormView.form_valid(self, form)
コード例 #33
0
 def form_valid(self, form):
     club = self.club
     form.save()
     self.form = form
     return FormView.form_valid(self, form)
コード例 #34
0
ファイル: views.py プロジェクト: mgoeminne/Lexpage
    def form_valid(self, form):
        data = form.cleaned_data
        message = Message(author=self.request.user, thread=self.thread, text=data['text'])

        return FormView.form_valid(self, form)
コード例 #35
0
 def form_valid(self, form):
     # This method is called when valid form data has been POSTed.
     # It should return an HttpResponse.
     form.create_event(self.get_object())
     return FormView.form_valid(self,form)
コード例 #36
0
ファイル: views.py プロジェクト: hkk710/cir-amrita
 def form_valid(self, form):
     form.save()
     return FormView.form_valid(self, form)
コード例 #37
0
 def form_valid(self, form):
     form.instance.course_user = self.request.user
     form.save(commit=True)
     send_mail('emails/course_created.html', {'user': self.request.user, 'course': form.instance.course_name },
               '*****@*****.**', [self.request.user.email,'*****@*****.**'])
     return FormView.form_valid(self, form)
コード例 #38
0
 def form_valid(self, form):
     course = self.kwargs['course_id']
     course = Course.objects.get(pk=course)
     form.instance.course = course
     form.save(commit=True)
     return FormView.form_valid(self, form)
コード例 #39
0
 def form_valid(self, form):
     obj = form.save(False)
     obj.pub_date = datetime.datetime.now()
     obj.save()
     return FormView.form_valid(self, form)
コード例 #40
0
ファイル: views.py プロジェクト: surendhar007/workshop
 def form_valid(self, form):
     form.save()
     return FormView.form_valid(self, form)
コード例 #41
0
ファイル: views.py プロジェクト: Praneethtkonda/Junior
 def form_valid(self, form):
     form.save(commit=True)
     return FormView.form_valid(self, form)