my task is to create on main page of my web site two list one list for my 
post and second list categories titles which belong my post. i create that 
and work fine,and i create post details connect and again work fine. but i 
cant to work category details if i want to see list from my post which 
belong specific category i cant show me error page not found.


my code


my model

class Category(models.Model):
 categorytitle =models.CharField(max_length=1,choices=CAT_CHOICES,unique=True)
 slug= models.SlugField()

class Posts(models.Model):
    Title = models.CharField(max_length=100,blank=True)
    slug= models.SlugField()
    category = models.ManyToManyField(Category)


my view category


def view_category(request, slug):
category = get_object_or_404(Category, slug=slug)return 
render_to_response('blog/view_category.html', {
    'category': category,
    'posts': Posts.objects.filter(category=category)})


my urls category


url(r'^(?P<slug>[^\.]+)/$', views.view_category, name='view_category'),

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b206b8e0-3fd5-47ab-80e2-99a06806ad97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to