Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9239859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:05:20+00:00 2026-06-18T08:05:20+00:00

I have created a book application – each book contains several sections and each

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:05:21+00:00Added an answer on June 18, 2026 at 8:05 am

    Create base.html

    base.html

    <html>
       <head>
           <title>{% block title %}{% endblock %}</title>
    
           {% block css %}{% endblock %}
           {% block js %}{% endblock %}
       </head>
    
       <body>
            {% block content %}{% endblock %}
       </body>
    </html>
    

    page1.html

    {% extends "base.html" %}
    
    {% block title %}{{block.super}}"title here"{% endblock %}
    
    {% block css %}{{block.super}}
         "css here"
    {% endblock %}
    
    {% block js %}{{block.super}}
         "js here"
    {% endblock %}
    
    {% block content %}
         content here
    {% endblock %}
    

    Follow this pattern in other pages and you can now use different css/js as you want

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a flip book/page application. I have seen flash created flip
I have created a simple app and this is my folder structure lib/book.rb lib/user.rb
I have created an app which uses Application Settings and user defaults following the
I have an application ( Amnesia ) which lets you create memos/stickers/alarms/Phone Book, and
I've read this book section about git branches. I have create a branch called
I have created a JSP / servlets application running in Tomcat 7. It runs
I have created a personal contact book, with around 10 activity as per the
I have a pretty big web application that I created last year using ASP.NET
I've created an address book as described here and that works like a charm.
We've created a web application that is an a e-book reader. So one thing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.