Django Formview Edit Form using Formview Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Does Django scale?Django comments framework, set default form valuesInitial value is not working for ChoiceField on django-filtersHow can i correctly pass arguments to classbasedviews testing Django Rest Framework?I am new to django, I tried registration of users but there is a error while I try to go to the pageHow to copy queryset DjangoWhy dispatch method is taking long time to call target method in Django Rest Framework?django how to hide specific form filed and loop data inputLooping insert data to database with djangoDjango how to save time to the forms?

std::is_constructible on incomplete types

Who is Alexandra K. Trenfor? Did she say the quote?

Split coins into combinations of different denominations

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

How to keep bees out of canned beverages?

The art of proof summarizing. Are there known rules, or is it a purely common sense matter?

Will I lose my paid in full property

Book with legacy programming code on a space ship that the main character hacks to escape

What to do with someone that cheated their way through university and a PhD program?

What is it called when you ride around on your front wheel?

Is Electric Central Heating worth it if using Solar Panels?

How to not starve gigantic beasts

Are these square matrices always diagonalisable?

How to count in linear time worst-case?

How would I use different systems of magic when they are capable of the same effects?

Dynamic Return Type

Is Diceware more secure than a long passphrase?

What's the difference between using dependency injection with a container and using a service locator?

Map material from china not allowed to leave the country

Where did Arya get these scars?

My bank got bought out, am I now going to have to start filing tax returns in a different state?

What is a 'Key' in computer science?

Is accepting an invalid credit card number a security issue?

Could moose/elk survive in the Amazon forest?



Django Formview Edit Form using Formview



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Does Django scale?Django comments framework, set default form valuesInitial value is not working for ChoiceField on django-filtersHow can i correctly pass arguments to classbasedviews testing Django Rest Framework?I am new to django, I tried registration of users but there is a error while I try to go to the pageHow to copy queryset DjangoWhy dispatch method is taking long time to call target method in Django Rest Framework?django how to hide specific form filed and loop data inputLooping insert data to database with djangoDjango how to save time to the forms?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have created a form for editing particular post using generic formview, instead of overriding the object it creates an another instance and saving it in the table ..Need help



class showprofile(generic.FormView):
form_class=ProfileForm
template_name="blogs/profile_student.html"
success_url=reverse_lazy('blogs:student_profile')

def get(self,request,*args,**kwargs):
action=self.request.GET.get('action')
pk=self.request.GET.get('pk')
print pk
if action =='edit':
data=
data=super(showprofile,self).get_context_data(**kwargs)
fill=Profile.objects.filter(id=pk).first()
data['url']=fill.profile_pic
fill.profile_pic=""
print data['url']
data['form']=ProfileForm(instance=fill)
return render(request,self.template_name,data)
else:
data=Profile.objects.filter(id=pk)
print data
args='form':self.form_class,'list':data
print args
return render(request,self.template_name,args)



def post(self,request,*args,**kwargs):

form.save()
return render(request,self.template_name)









share|improve this question




























    0















    I have created a form for editing particular post using generic formview, instead of overriding the object it creates an another instance and saving it in the table ..Need help



    class showprofile(generic.FormView):
    form_class=ProfileForm
    template_name="blogs/profile_student.html"
    success_url=reverse_lazy('blogs:student_profile')

    def get(self,request,*args,**kwargs):
    action=self.request.GET.get('action')
    pk=self.request.GET.get('pk')
    print pk
    if action =='edit':
    data=
    data=super(showprofile,self).get_context_data(**kwargs)
    fill=Profile.objects.filter(id=pk).first()
    data['url']=fill.profile_pic
    fill.profile_pic=""
    print data['url']
    data['form']=ProfileForm(instance=fill)
    return render(request,self.template_name,data)
    else:
    data=Profile.objects.filter(id=pk)
    print data
    args='form':self.form_class,'list':data
    print args
    return render(request,self.template_name,args)



    def post(self,request,*args,**kwargs):

    form.save()
    return render(request,self.template_name)









    share|improve this question
























      0












      0








      0








      I have created a form for editing particular post using generic formview, instead of overriding the object it creates an another instance and saving it in the table ..Need help



      class showprofile(generic.FormView):
      form_class=ProfileForm
      template_name="blogs/profile_student.html"
      success_url=reverse_lazy('blogs:student_profile')

      def get(self,request,*args,**kwargs):
      action=self.request.GET.get('action')
      pk=self.request.GET.get('pk')
      print pk
      if action =='edit':
      data=
      data=super(showprofile,self).get_context_data(**kwargs)
      fill=Profile.objects.filter(id=pk).first()
      data['url']=fill.profile_pic
      fill.profile_pic=""
      print data['url']
      data['form']=ProfileForm(instance=fill)
      return render(request,self.template_name,data)
      else:
      data=Profile.objects.filter(id=pk)
      print data
      args='form':self.form_class,'list':data
      print args
      return render(request,self.template_name,args)



      def post(self,request,*args,**kwargs):

      form.save()
      return render(request,self.template_name)









      share|improve this question














      I have created a form for editing particular post using generic formview, instead of overriding the object it creates an another instance and saving it in the table ..Need help



      class showprofile(generic.FormView):
      form_class=ProfileForm
      template_name="blogs/profile_student.html"
      success_url=reverse_lazy('blogs:student_profile')

      def get(self,request,*args,**kwargs):
      action=self.request.GET.get('action')
      pk=self.request.GET.get('pk')
      print pk
      if action =='edit':
      data=
      data=super(showprofile,self).get_context_data(**kwargs)
      fill=Profile.objects.filter(id=pk).first()
      data['url']=fill.profile_pic
      fill.profile_pic=""
      print data['url']
      data['form']=ProfileForm(instance=fill)
      return render(request,self.template_name,data)
      else:
      data=Profile.objects.filter(id=pk)
      print data
      args='form':self.form_class,'list':data
      print args
      return render(request,self.template_name,args)



      def post(self,request,*args,**kwargs):

      form.save()
      return render(request,self.template_name)






      django formview






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 9 at 5:50









      Asif MohdAsif Mohd

      11




      11






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074422%2fdjango-formview-edit-form-using-formview%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074422%2fdjango-formview-edit-form-using-formview%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович