I have a model, News, that has a ForeignKey to another model, Category.
The categories are defined with id, name, slug and a few more parameters.
My categories will never change in the future, so I am wondering why have I to store them in the database.
Is there any way to hardcode them inside the code, like using the choices or any other technique?
I have a model, News, that has a ForeignKey to another model, Category. The
Share
yes,
choices: store pairs of ID+name as a tuple of tuples and in another structure any other parameters.then you can use other params following way:
or create simple wrapper class: