Hello,

Problem:
--------
 
I basically have a blog with a ``Post`` model, representing each post of
the blog. Now if I create an object, save it and want to view it I get
a 404 Error with Django saying "No post found for".
This like this until I restart the development server (actually when
deploying the same pattern occurs).

Here's the code:

# blog/models.py:

class Post(models.Model):

    [snip]

    def save(self, force_insert=True, force_update=False, *args, **kwargs):
        [snip]
        super(Post, self).save(force_insert, force_update, *args, **kwargs)
        # For debugging:
        print Post.objects.all()
        # After creating a sample post it *actually* returns a list with
        # the newly created and saved object. That's the strange thing.

# blog/views.py

[snip]

post_info_dict = {
    'queryset': Post.objects.all(),
    'date_field': 'date',
    }

urlpatterns = patterns('',
    (r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        'django.views.generic.date_based.object_detail',
        dict(post_info_dict, month_format = "%m"),),
        [snip]

Troubleshooting:
----------------

Well I actually browsed the Post list (without restarting the
development server
I've also passed 'force_insert=True' with the save() function, but
doesn't affect the behaviour in any way appearently.
I could have debugged some SQL debugging, but I'm unfortunately not
very experienced with that.

I hoped that you could tell me what I'm doing wrong. I hope I'm being
detailed, if not, please request me for more info or ask.

-- 
Best regards,
Kenny

Attachment: signature.asc
Description: Digital signature

Reply via email to