Best naming convention for handling multiword Django models? -


what best naming convention instance, url , template names of django models more 1 word?

instances

  1. yetanothermodel = yetanothermodel()
  2. yet_another_model = yetanothermodel()

url names

  1. 'yetanothermodel_detail'
  2. 'yet_another_model_detail'

template names

  1. 'yetanothermodel_detail.html'
  2. 'yet_another_model_detail.html'

it personal choice. if working in team should applying python pep8 standard of coding; way members of team using same process , naming conventions write code.

in instance:

yet_another_model = yetanothermodel() 

variables names should lower-case, underscore separated. class names using camel casing naming convention.

and

'yet_another_model_detail' 

url names should treat variable name or function name, lower-case separated _ (underscores).

templates:

whilst there no defined naming convention templates treat naming same function name. in these cases go lower-case underscore word separation. keep templates inside of django apps (sometimes, have templates directory have directory each app name).

i stick crud type @ end of filename.

for example:

<app_div>/user_profile.html <app_dir>/user_profile_update.html <app_dir>/user_profile_view.html <app_dir>/user_profile_delete.html 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -