> 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'),
>
>

{% for category in categories %}
<li><a href="{{ category.slug }}">{{ category.categorytitle }}</a></li>

{% endfor %} 

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/6a7d043e-a53d-42af-88bc-c56483469686%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to