I have a question: “How should I name apps, views, models, forms, fields, etc?”
For example I have a browser game that has a mailbox implemented.
App cannot be named mailbox so I name it pm_box (is that good?)
Then I have to create model where all the messages are held. What model name should be? Message or Messages? It should have a boolean field which is True if message has already been read. Should that field be called read or is_read?
Then I have a view that lists the messages. Should I name it list_messages, message_list, message_list_view or list_messages_view (if I do not specify inbox/outbox)?
The the form for new message input data validation. Should the form be named NewMessageForm, MessageWritingForm..?
After that I want to keep track of timestamps for every player. For this purpose I have Player model (or should it be Players)? With OneToOne field to the user and OneToOne field to Timestamp model (or timestamps) that has fields: online, last_pm_sent, some_action.
Thanks for all your answers. I have already read django styling documentation and pep, however, nowhere these things are specified.
EDIT: The project name (in pyCharm) is my game name. How should I name the first app and where should I hold the Player(s) model (in which app) which is UserProfile as well.
Alright starting with what you’ve named,
it must not be pm_box, try naming discretely, if something is keyword try finding an appropriate synonym, here PersonalMessage and your view folder will be personal_messages while file will be usually good like single word, eg. enlist.html, display.html, etc. will be good, we mostly follow this structure in django:
Model Class Name
Form Class Name:
Boolean Variables:
Views:
Though you may not entirely need a new model to keep 1-to-1 relationship, a better approach would be to add more fields to current table. Timestamp conventions could be like, last_visited_at, last_played_at, etc.
You could give app a name by defining in model as: