-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added search form, view and templates
- Loading branch information
1 parent
7769dca
commit 6e9d940
Showing
8 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django import forms | ||
from django.utils.translation import ugettext as _ | ||
|
||
|
||
class SearchForm(forms.Form): | ||
q = forms.CharField(label=_('keywords'), max_length=128) |
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
25 changes: 25 additions & 0 deletions
25
technology_radar/templates/technology_radar/radar_blip_list.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% load i18n technology_radar_tags %} | ||
|
||
<h1>{{ radar.name }}</h1> | ||
<form action="{% url 'radar-blip-list' radar.slug %}" method="GET"> | ||
{% if form.q.errors %} | ||
<p> | ||
{% for error in form.q.errors %} | ||
{{ error }} | ||
{% endfor %} | ||
</p> | ||
{% endif %} | ||
{{ form.q }} | ||
<input type="submit" value="{% trans "Search" %}" /> | ||
</form> | ||
{% if blips %} | ||
<ul> | ||
{% for blip in blips %} | ||
<li> | ||
<a href="{% url 'blip-detail' radar.slug blip.area.slug blip.slug %}">{{ blip.name }} ({{ blip.status }}){% if blip.is_new %} <span class="badge">{% trans "new" %}</span>{% endif %}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<p>{% trans "No blips are available." %}</p> | ||
{% endif %} |
4 changes: 4 additions & 0 deletions
4
technology_radar/templates/technology_radar/radar_blip_list_results.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load i18n technology_radar_tags %} | ||
|
||
<h1>{{ radar.name }}</h1> | ||
<h2>{% trans "Search results" %}</h2> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
from technology_radar.utils import import_class | ||
from technology_radar import utils # noqa | ||
|
||
|
||
def test_import_class_raise_error(): | ||
pass | ||
|
||
|
||
def get_alphabetically_sorted_list(): | ||
pass |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
import importlib | ||
|
||
|
||
ALPHABETICALLY_CHARACTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', | ||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', | ||
'u', 'v', 'w', 'x', 'y', 'z'] | ||
|
||
|
||
def import_class(name): | ||
module_name, class_name = name.rsplit('.', 1) | ||
return getattr(importlib.import_module(module_name), class_name) | ||
|
||
|
||
def get_alphabetically_sorted_list(items, attribute='name'): | ||
return items |
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