Hello all,

           I am writing a simple blog app. I wrote a post and comment
model where I need views to serve them. I could use generic views but
I think I cannot due to the fact that comment model needs to link to
post model.
So i am writing a view which serves url like:
http://example.com/blog/2008/apr/06/slug

To write a view I need to match all the four items year, month, date,
slug. So I want to write a helper.py with

def get_post(year, month, day, slug):
    year, month = int(year), month, int(day)

    try:
        return Post.objects.get(
            pub_date__year=year, pub_date__day=day, slug__exact=slug)
    except Post.DoesNotExist:
        raise Http404

As you can see my month is in 'Apr' format how to match them with
month in pub_date.

Also is there a way to use generic views with my comment model.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to