I'm going through Sam's 24 hour.  I've looked at this code for hours
now, starting from about a week ago. I decided it wasn't that
important and moved on. But now the author keeps referring back to
this view and it hampers my continuing the code. It basically just
adds a blog object as an attribute of a Person object.  Here is the
entire view:

http://dpaste.com/120042/

But when I try to post the blog I get the error:

'Database Error'.

So, that seems to indicate that the saveform.is_valid condition is
true but the "try" hit an exception.  Which means that there is
something wrong with the following four lines of code after the try:

try:
     bObj = saveform.save()
     p.blogs.add(bObj)
     p.save()
     message = 'Blog added to %s. ' % p.name

There is something about this code that seems redundant, but the
saveform.save() is for the database entry for the blog model.  The
p.save() just links the blog as an attribute of the Person in the db.
So, the code seems to be fine.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to