Сейчас пытался в urls.py передать переменную с именами статей, в итоге при переходе на страницу пишет что такой страницы нет(:
Вот urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from istolp.views import articles
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^(?P)', articles),
#url(r'^$', articles),
#url(r'^dostavka/', articles),
#url(r'^garantiya/', articles),
#url(r'^zakaz/', articles),
#url(r'^about/', articles),
#url(r'^reshetki/', articles),
#url(r'^vorota/', articles),
# url(r'^istolp/', include('istolp.foo.urls')),
url(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^tinymce/',include('tinymce.urls')),
url(r'^admin/filebrowser/', include('filebrowser.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
#url(r'^admin_tools/', include('admin_tools.urls')),
)
Вот весь views.py:
def articles(request, link):
if request.path == "/":
article = Article.objects.get(name="Главная")
elif request.path == "/dostavka/":
article = Article.objects.get(name="Доставка")
elif request.path == "/garantiya/":
article = Article.objects.get(name="Гарантия")
elif request.path == "/zakaz/":
article = Article.objects.get(name="Как заказать")
elif request.path == "/about/":
article = Article.objects.get(name="О нас")
elif request.path == "/reshetki/":
article = Article.objects.get(name="Решетки")
elif request.path == "/vorota/":
article = Article.objects.get(name="Ворота")
links = Article.objects.all()
link == [link.name for link in links]
return direct_to_template(request,'articles.html', {'article':article,'links':links})
Updated 7 June 2012, 1:29 by angelofthedeath1488.