Skip to content

Instantly share code, notes, and snippets.

@ashwoods
Created June 18, 2012 17:38
Show Gist options
  • Save ashwoods/2949599 to your computer and use it in GitHub Desktop.
Save ashwoods/2949599 to your computer and use it in GitHub Desktop.
<html>
<body>
{% block content %}
I am the parent, and any template extending me and has a block content will replace this sentence.
{% endblock %}
</body>
</html>
{% extends "base.html" %}
{% block content %}
<div class="actions">
{% if user.is_staff %}
<a href="{% url admin:index %}">admin</a>
{% endif %}
<a href="{% url logout %}">logout</a>
</div>
<div class="search">
<form method="get" action="{% url clients.views.search %}">
<input type="text" name="q" />
<input type="submit" value="Search!" />
</form>
</div>
{% if q %}
<h2>Searched for: {{ q|lower }}</h2>
<div class="result">
{% if companies.exists %}
<h3>Found companies:</h3>
<ul>
{% for company in companies.isort %}
<li>
<a href="{{ company.get_absolute_url }}">{{ company }}</a>
</li>
{% endfor %}
</ul>
{% else %}
<h3>[No companies found]</h3>
{% endif %}
</div>
<div class="result">
{% if people.exists %}
<h3>Found people:</h3>
<ul>
{% for person in people.isort %}
<li>
<a href="{{ person.get_absolute_url }}">{{ person }}</a>
</li>
{% endfor %}
</ul>
{% else %}
<h3>[No people found]</h3>
{% endif %}
</div>
{% endif %}
{% endblock%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment