https://t.me/django_docs_uz
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
: [
'/home/html/example.com'
,
'/home/html/default'
,
],
},
{
'BACKEND'
:
'django.template.backends.jinja2.Jinja2'
,
'DIRS'
: [
'/home/html/jinja2'
,
],
},
]
Agar siz
get_template('story_detail.html')
deb nomlansangiz, Django quyidagi tartibda qidiradi:
/home/html/example.com/story_detail.html
(
'django'
dvigatel
(engine)
)
/home/html/default/story_detail.html
(
'django'
dvigatel)
/home/html/jinja2/story_detail.html
(
'jinja2'
dvigatel)
Agar siz
select_template(['story_253_detail.html', 'story_detail.html'])
ga qo'ng'iroq qilsangiz, Django
quyidagilarni qidiradi:
/home/html/example.com/story_253_detail.html
(
'django'
dvigatel)
/home/html/default/story_253_detail.html
(
'django'
dvigatel)
/home/html/jinja2/story_253_detail.html
(
'jinja2'
dvigatel)
/home/html/example.com/story_detail.html
(
'django'
dvigatel)
/home/html/default/story_detail.html
(
'django'
dvigatel)
/home/html/jinja2/story_detail.html
(
'jinja2'
dvigatel)
Django mavjud shablonni topganda, u qidirishni to'xtatadi.
Maslahat
Moslashuvchan shablonni yuklash uchun
select_template()
dan foydalanishingiz mumkin. Misol uchun, agar siz
yangilik yozgan bo'lsangiz va ba'zi hikoyalar uchun maxsus andozalar bo'lishini istasangiz,
Do'stlaringiz bilan baham: |