Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9206721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:14:07+00:00 2026-06-18T00:14:07+00:00

I’m trying to edit an existing object through a form, but every thing is

  • 0

I’m trying to edit an existing object through a form, but every thing is not being populated with the current value.
This object did have a value but when I went to edit, nothing showed up in the all field and only showing blank field.

Here’s the model:

class Flow (models.Model):
    title = models.CharField("Title", max_length=200)
    slug = models.SlugField(unique=True)
    description = models.TextField("Description")
    url = models.URLField("URL")
    tags = TaggableManager()
    flow_date = models.DateTimeField(auto_now_add=True, blank=True, null=True)
    author = models.ForeignKey('auth.User', null=True)

    def __unicode__(self):
        return self.title

    @permalink
    def get_absolute_url(self):
        return ('flow.views.details', (), {'slug':self.slug})

    def save(self, *args, **kwargs):
        if not self.slug:
            self.slug = slugify(self.title)
        return super(Flow, self).save(*args, **kwargs)

    class Meta:
        verbose_name = 'Flow'

Here’s the view

class FlowForm(forms.ModelForm):
    class Meta:
        model = Flow
        exclude = ['flow_date', 'slug']

@login_required
def edit(request, flow_id = None):
    flow = None
    if flow_id is not None:
        flow = get_object_or_404(Flow, pk=flow_id)

    if request.method == 'POST':
        form = FlowForm(request.POST, instance=flow)
        if form.is_valid():
            tags = form.cleaned_data['tags']
            newflow = form.save(commit=False)
            newflow.save()
            for tags in tags:
                newflow.tags.add(tags)
            return HttpResponseRedirect(newflow.get_absolute_url())
    else:
        form = FlowForm(request.POST, instance=flow)
    return render_to_response('flow/flow_edit.html', {'form':form, 'flow':flow,}, context_instance=RequestContext(request))

Thanks in advance.

UPDATE

Thank you Daniel.

Now I want to delete the object including their django-taggit object. It work with following definition but the tag still show on tag cloud list based on django-taggit-templatetags.

@login_required
def delete(request, flow_id):
    flow = Flow.objects.get(pk=flow_id)
    flow.delete()
    return render_to_response('flow/flow_delete.html', {'flow':flow,}, context_instance=RequestContext(request))

How to remove selected django-taggit’s object/count from form/database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:14:08+00:00Added an answer on June 18, 2026 at 12:14 am

    You’re passing in request.POST as the data argument to the form instantiation in the else clause, when the request is not a POST and so therefore that is an empty dictionary. Even though it’s empty, it will still override all fields from the instance, because instance values are only used as defaults and will not be displayed when anything is passed as data. Change that line to just:

    form = FlowForm(instance=flow)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.