﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10544	Saving ModelForm to update exisitng record generates No {model} matches the given query.	mcwong644	nobody	"#models.py

class Publisher(models.Model):

    name = models.CharField(max_length=30)

    address = models.CharField(max_length=50)

    city = models.CharField(max_length=60)

    state_province = models.CharField(max_length=30)

    country = models.CharField(max_length=50)

    website = models.URLField()

    def __unicode__(self):

        return self.name

    class Meta:

        ordering = [""name""]


class Author(models.Model):

    first_name = models.CharField(max_length=30)

    last_name = models.CharField(max_length=40)

    email = models.EmailField(blank=True, verbose_name='e-mail')

    objects = models.Manager()

    sel_objects=AuthorManager()
    
    def __unicode__(self):

        return self.first_name+' '+ self.last_name


class Book(models.Model):

    title = models.CharField(max_length=100)

    authors = models.ManyToManyField(Author)

    publisher = models.ForeignKey(Publisher)

    publication_date = models.DateField(blank=True, null=True)

    num_pages = models.IntegerField(blank=True, null=True)

    objects = models.Manager()

    bookobjects = BookManager()

    wong = WongAuthor()


class BookForm(ModelForm):

    class Meta:

        model = Book


#view.py
def authorcontactupd(request,id):
    if request.method == 'POST':
        a=Author.objects.get(pk=int(id))
        form = AuthorForm(request.POST, instance=a)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/contact/created')
    else:
        a=Author.objects.get(pk=int(id))
        form = AuthorForm(instance=a)
    return render_to_response('author_form.html', {'form': form})


# error


Page not found (404)
Request Method: 	POST
Request URL: 	http://127.0.0.1:8000/books/bookupd/

No Publisher matches the given query.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
"		new	Uncategorized	1.0					Unreviewed	0	0	0	0	0	0
