0

i have a base.html which includes some user profile data which are e-mail , web-site etc.

i need to extend this base.html to my index.html. i can show those data in index.html. because in index page's view i have username paramater [ also in url's ].

how can i handle this ? here is my objects.get code in index view :

def user_index(username,request):
    user = Profile.objects.filter(owner__username=username)
    .....

and my related url part :

url(r'^blog/(?P<username>[-\w]+)/$',view='user_index', name='user_index'),

1 Answer 1

1

You can do

index.html

{% extends 'base.html' %}

{% block content %}

{% endblock content %}

and in

base.html

<doctype ...>
...

{% block content %}
{% endblock content %}

...

Here, the index.html would extend (inherit) from base.html, and render the contents in {% block content %}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.