Best naming convention for handling multiword Django models? -
what best naming convention instance, url , template names of django models more 1 word?
instances
yetanothermodel = yetanothermodel()
yet_another_model = yetanothermodel()
url names
'yetanothermodel_detail'
'yet_another_model_detail'
template names
'yetanothermodel_detail.html'
'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
Post a Comment