I have created a book application - each book contains several sections and each section contains several sub-sections.
The app works fine and each sub-section "shows" its content on the right page etc.. Problem is that I want that each sub-section will have a different html/css/js code & effects.
Here is some of the URLS.PY code:
url(r'^admin/', include(admin.site.urls)),
(r'^$', direct_to_template, {'template': 'index.html'}),
(r'^book/$','book.views.BookAll'),
(r'^book/$','book.views.BookAll'),
(r'^book/(?P<slug>[-\w]+)/$','book.views.Ssection_specific'),
(r'^book/info/(?P<slug>[-\w]+)/$','book.views.Ssection_details'),
)
Some of the views.py code:
def Ssection_specific(request, slug): #display according to specified section object.
try:
section = Section.objects.get(slug=slug)
except Section.DoesNotExist:
raise Http404
ssection = SSection.objects.filter(section = section).order_by('subject')
context = {'ssection' : ssection,'section' : section}
return render_to_response('section_display.html', context, context_instance = RequestContext(request))# creates
def Ssection_details(request, slug):
try:
ssection = SSection.objects.get(slug = slug)
except SSection.DoesNotExist:
raise Http404
context = {'ssection' : ssection}
return render_to_response('info/ssection_disp.html', context, context_in)
As you can see, each sub section's page is determined by the slug. Of course that each one of them will have the SAME template and that is my problem. I want to make different css/js effects for each page.