Compare commits
4 Commits
starfields
...
starfields
| Author | SHA1 | Date | |
|---|---|---|---|
| 75e9a60b87 | |||
| 0f26c16b15 | |||
| c1fd01a6d8 | |||
| c234f7b1ce |
@@ -1,4 +1,4 @@
|
||||
from libraries.utils import sorted_params_string
|
||||
from starfields_drf_generics.utils import sorted_params_string
|
||||
|
||||
# TODO classes below that involve create, update, destroy don't delete the caches properly, they need a regex cache delete
|
||||
# TODO put more reasonable asserts and feedback
|
||||
@@ -10,7 +10,7 @@ from rest_framework import views
|
||||
from rest_framework.generics import GenericAPIView
|
||||
from rest_framework.settings import api_settings
|
||||
|
||||
from libraries import mixins
|
||||
from starfields_drf_generics import mixins
|
||||
|
||||
|
||||
# Concrete view classes that provide method handlers
|
||||
@@ -8,7 +8,7 @@ from rest_framework import status
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.settings import api_settings
|
||||
from rest_framework import mixins
|
||||
from libraries.cache_mixins import CacheGetMixin, CacheSetMixin, CacheDeleteMixin
|
||||
from starfields_drf_generics.cache_mixins import CacheGetMixin, CacheSetMixin, CacheDeleteMixin
|
||||
|
||||
|
||||
# Mixin classes to be included in the generic classes
|
||||
14
starfields_drf_generics/templates/filters/categories.html
Normal file
14
starfields_drf_generics/templates/filters/categories.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% load rest_framework %}
|
||||
{% load i18n %}
|
||||
<h2>{% trans "Categories" %}</h2>
|
||||
<div class="list-group">
|
||||
{% for key, label in options %}
|
||||
{% if key == current %}
|
||||
<a href="{% add_query_param request param key %}" class="list-group-item active">
|
||||
<span class="glyphicon glyphicon-ok" style="float: right" aria-hidden="true"></span> {{ label }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% add_query_param request param key %}" class="list-group-item">{{ label }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
23
starfields_drf_generics/templates/filters/facets.html
Normal file
23
starfields_drf_generics/templates/filters/facets.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% load rest_framework %}
|
||||
{% load i18n %}
|
||||
<h2>{% trans "Facets" %}</h2>
|
||||
{% for facet_tag_slug_key, facet_tag_slug_values in options.items %}
|
||||
{% for facet_slug, facet_name in facet_slug_names.items %}
|
||||
{% if facet_slug == facet_tag_slug_key %}
|
||||
<h3>{{ facet_name }}</h3>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="list-group">
|
||||
{% for tag_slug in facet_tag_slug_values %}
|
||||
{% if tag_slug.0 in current %}
|
||||
{# TODO this does not remove parameters #}
|
||||
<a href="{% add_query_param request facet_tag_slug_key tag_slug.0 %}" class="list-group-item active">
|
||||
<span class="glyphicon glyphicon-ok" style="float: right" aria-hidden="true"></span> {{ tag_slug.1 }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% add_query_param request facet_tag_slug_key tag_slug.0 %}" class="list-group-item">{{ tag_slug.1 }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
12
starfields_drf_generics/templates/filters/slug.html
Normal file
12
starfields_drf_generics/templates/filters/slug.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% load i18n %}
|
||||
<h2>{% trans "Slug" %}</h2>
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" style="width: 350px" name="{{ param }}" value="{{ term }}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> {% trans "Slug" %}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
Reference in New Issue
Block a user