>No I don't know what your business logic for the view/model would be. >I was just showing an example of how you could take keywords from your >request url and map them to your models to display results to the user >without having to hard-code them in your urls or settings or whatever.
Oh okay :) I'll test with dicts and lists to see if it that works well. >Again it's however you want to model your data. For the sake of >normalization (and typing/database size/etc) I'd probably have one >model for categories: Yes me too. Plus I totally forgot to say that I use a NoSQL database, so I'll put every item directly in the category 'table'. Thanks for your help ! Nolhian On Nov 29, 10:22 pm, DrBloodmoney <drbloodmo...@gmail.com> wrote: > On Tue, Nov 29, 2011 at 3:37 PM, Nolhian <eldur...@hotmail.com> wrote: > > Thanks ! > > > So you'll not check if the category/item exists ( if a user enter a > > bad url ), you'll just hit the database to check if it does in fact > > exists ? > > No I don't know what your business logic for the view/model would be. > I was just showing an example of how you could take keywords from your > request url and map them to your models to display results to the user > without having to hard-code them in your urls or settings or whatever. > > > 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" ! > > > Well that could be a solution but only 1 collection for a lot of > > different unrelated categories seems really odd to me, why not a model > > per category ? > > Again it's however you want to model your data. For the sake of > normalization (and typing/database size/etc) I'd probably have one > model for categories: > > class Category(models.Model): > ... > > class Item(models.Model): > category = models.ForeignKey(Category, related_name='items') > ... > > and so forth. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.