I created a django project. It contains a model class with a “type” attribute. I think that “type” is the most appropriate term to describe that field, because it defines the kind of the entry.
class Vehicle(models.Model):
TYPE = (
(u'car', u'Car'),
(u'motorcycle', u'Motorcycle'),
(u'airplane', u'Airplane'),
)
type = models.CharField(max_length=100, choices=TYPE)
I do not like “kind” or “category” that much because they are not as generic as “type”.
The problem
Assignment to reserved built-in symbol: type
- This is a warning, so is that a problem?
- If yes, what choices do i have?
- Do you have a good alternative to the term “type”?
python’s built-ins. It will confuse people reading your code, who expect type to mean something specific. Less important than readability to other users it can also throw off syntax highlighting.
classificationorcategory. I know you said you don’t likecategory, but I can’t see what’s not generic about it?It might be that it would be overkill for your specific application (would need to know more), but django does support model inheritance.