I have some (hundreds of) messages with a type:
Type Message
1 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
1 Maecenas eu risus a arcu rutrum vehicula vel in neque.
1 Curabitur ante sapien, cursus nec diam non, porttitor sagittis leo.
2 Nunc et nisi nec ligula placerat accumsan.
2 In lacinia, neque rutrum aliquet luctus, odio ligula accumsan risus.
3 ...
3 ...
... ...
I want to select a random message from type 1 messages, or type 2 messages, etc. I want to build an efficient way. So my questions are:
How should i store these messages? With a list, dictionary, txt or DB table (i'm also using Django). Messages will be static. I won't change or edit them regularly. Buy maybe in the future i'll need to use translations for other languages.
How can i select a RANDOM message according to type? i.e. "a random message with type 1".
Thanks all,
Aucun commentaire:
Enregistrer un commentaire