Last active
April 28, 2016 17:51
-
-
Save malgorath/4432176b97e5338cd231cc5668fa1898 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if links %} | |
{% regroup links by links.linkgroup as link_list %} | |
{% for l in link_list %} | |
<li> | |
<h4>{{ l.grouper }}</h4> | |
<ul> | |
{% for i in l.linkgroup %} | |
<li>{{ i.title }}</li> | |
{% endfor %} | |
</ul> | |
</li> | |
{% endfor %} | |
{% else %} | |
<p>We got no links!</p> | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render | |
from links.models import Link | |
def index(request): | |
links = Link.objects.all().order_by("-linkgroup") | |
return render(request, 'index.html', {'links': links}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment