Hi

I'm fairly new to django and I'm having problems with the generic views. 
As many others I'm making a blog application, and I want to use the 
object_list view to construct a list of all Posts with a certain Tag (My 
code is further down). I've been looking through the examples and the 
djangobook for this and tried to find ehlp with google. The problem is 
that I can't find an understandable explanation on how to do this. How 
do I contruct the queryset to return a correct list with Posts with the 
certain tag?

code:

urlpatterns = patterns('django.views.generic.list_detail',
    (r'^tag/(?P<slug>[-\w]+)/', 'object_list', tag_view),
)

tag_view = {
    'queryset': Tag.post_set.filter(),
}
 
class Tag(models.Model):
    slug = models.SlugField('Slug')
    title = models.CharField('Title', maxlength=30)
    description = models.TextField('Description')

class Post(models.Model):
    slug = models.SlugField('Slug')
    assoc_tags = models.ManyToManyField(Tag)
    title = models.CharField('Title', maxlength=30)
    date = models.DateTimeField('Date')
    body = models.TextField('Body Text')

I'd be thankful for any replies or links to examples. Have a nice 
weekend while you're at it!

/ Tom Baylis


--~--~---------~--~----~------------~-------~--~----~
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