Created
February 19, 2016 19:58
-
-
Save gileno/c539232c3e565cfa25e1 to your computer and use it in GitHub Desktop.
Django Filter
This file contains hidden or 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
def minha_view(request): | |
marca = request.GET.get("marca", "") | |
if marcar: | |
context["brands_list"] = Post.objects.filter(is_active=True, brands__exact='MARCA01').order_by('created_date') | |
else: | |
context["brands_list"] = Post.objects.filter(is_active=True).order_by('created_date') |
HigorMonteiro
commented
Feb 19, 2016
index.html
<div class="container">
<div class="col-md-4 text-center"><a href="{% url 'brands' %}?marca=MARCA01"><img src="{{ MEDIA_URL }}static/imagens/img01.png" width="316" height="17" class="imagem logo_maior"></a></div>
<div class="col-md-4 text-center"><a href="{% url 'brands' %}?marca=MARCA01"><img src="{{ MEDIA_URL }}static/imagens/img02.png" width="220" height="54" class="imagem"></a></div>
<div class="col-md-4 text-center"><a href="{% url 'brands' %}?marca=MARCA01"><img src="{{ MEDIA_URL }}static/imagens/img03.png" width="178" height="49" class="imagem"></a></div>
</div>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment