Re: Choices of foreign keys?

2009-09-09 Thread Peter Coles
Oh sorry, thought you wanted multiple categories per photo. Tim's response above is good. As he said, I'd go with the ForeignKey approach, this makes the categories easier to manage and gives you further flexibility of storing additional information within each category (if you want). Also his

Re: Choices of foreign keys?

2009-09-09 Thread Tim
For something like categories, I would go with a separate model and use ForeignKey. For that 1% chance when you have to add a new category, it will be a lot easier. Plus, what if requirements change in the future and you are adding/deleting categories more than you anticipated? Using choices

Re: Choices of foreign keys?

2009-09-09 Thread Léon Dignòn
Hello Peter, sorry, I was talking about choices, not a choice field: http://docs.djangoproject.com/en/dev/ref/models/fields/#choices Since any photo can only belong to one category (because I say so :) I would tend towards using 1:N instead of M:N. Or did I missunderstand you? If one photo can

Re: Choices of foreign keys?

2009-09-09 Thread Peter Coles
Hey Léon, ChoiceField is a form field, not a table column—maybe you're thinking about CommaSeparatedIntegerField? You could use that and hardcode which categories represent which ids in your python code. http://docs.djangoproject.com/en/dev/ref/models/fields/#commaseparatedintegerfield On the

Choices of foreign keys?

2009-09-09 Thread Léon Dignòn
Hello, let's assume we have a model for photos with the fields id, user, photo. Any user should be able to categorize his foto with a given number of categories, e.g. person, car, building. In future it's possible that I add more categories. My question is whether the new category field should