Wednesday, November 30, 2011

Re: A view associated with a lot of urls

> Sorry, it was DrBloodmoney, who wrote this:
>
> > class Category(models.Model):
> >    name = models.CharField.... # should be unique
>
> > class Item(models.Model):
> >  name = models.CharField()
> >   category = models.ForeignKey(Category, related_name='items')
>

Oh that, yes I intended to do so.

>Now if someone enters a category by hand which does not exist, he gets a >404. If the category exists, but there is no item with such a name items will >be empty.

Well I agree that if the category doesn't exist he will get a 404. But
if the Category exists and there are no items in the 'table', it will
not be empty, it will also raise a 404 too. That's why I wrote :

>However with that, there is no way for example to make a difference
>between "there is no items in this category" and "this category
>doesn't exist" !

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment