Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit fbb90bd

Browse files
committed
fix merge conflict
2 parents 3195c93 + 53c701f commit fbb90bd

File tree

4 files changed

+267
-1
lines changed

4 files changed

+267
-1
lines changed

api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from api.processors import get_approved_events
66

77
class EventListApi(generics.ListAPIView):
8-
""" Lists epproved Events, takes the following optional GET parameters:
8+
""" Lists approved Events, takes the following optional GET parameters:
99
1010
* limit
1111
* order
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
{% extends 'base.html' %}
2+
{% load url from future %}
3+
{% load staticfiles %}
4+
{% load rest_framework %}
5+
{% load compress %}
6+
7+
{% block custom_css %}
8+
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/prettify.css" %}" />
9+
<style type="text/css">
10+
form {
11+
border: 0;
12+
padding: 5px;
13+
margin: 0
14+
}
15+
16+
fieldset {
17+
border: 0;
18+
padding: 0;
19+
margin: 0;
20+
}
21+
22+
.navbar-brand{
23+
font-size: 45px;
24+
}
25+
.cweu-navbar .cweu-navbar-list{
26+
margin-top: 10px;
27+
}
28+
</style>
29+
{% endblock %}
30+
31+
{% block main_navigation %}
32+
<nav class="navbar cweu-navbar" role="navigation">
33+
<div class="container">
34+
<div class="navbar-header">
35+
<button type="button" class="navbar-toggle" data-toggle="collapse"
36+
data-target="#cweu-navbar-collapse">
37+
<span class="sr-only">Toggle navigation</span> <i class="fa fa-bars"></i>
38+
</button>
39+
<a class="navbar-brand" href="http://codeweek.eu">
40+
<img src="/static/img/new_logo_white_tilted.png" alt="Codeweek EU Logo" width="250"
41+
height="50"> API
42+
</a>
43+
</div>
44+
<div class="collapse navbar-collapse navbar-right" id="cweu-navbar-collapse">
45+
<ul class="nav navbar-nav cweu-navbar-list">
46+
<li class="dropdown open">
47+
<a href="/" class="active">Events</a>
48+
</li>
49+
</ul>
50+
</div>
51+
</div>
52+
</nav>
53+
{% endblock %}
54+
55+
{% block content %}
56+
<div class="container">
57+
{% block breadcrumbs %}
58+
<ul class="breadcrumb">
59+
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
60+
<li>
61+
<a href="{{ breadcrumb_url }}" {% if forloop.last %}class="active"{% endif %}>
62+
{{ breadcrumb_name }}
63+
</a> {% if not forloop.last %}<span class="divider">&rsaquo;</span>{% endif %}
64+
</li>
65+
{% endfor %}
66+
</ul>
67+
{% endblock %}
68+
69+
<!-- Content -->
70+
<div id="content">
71+
{% if 'GET' in allowed_methods or options_form or delete_form %}
72+
<div class="clearfix">
73+
{% if 'GET' in allowed_methods %}
74+
<form id="get-form" class="pull-right">
75+
<fieldset>
76+
<div class="btn-group format-selection">
77+
<a class="btn btn-primary js-tooltip" href='{{ request.get_full_path }}'
78+
rel="nofollow" title="Make a GET request on the {{ name }} resource">GET</a>
79+
80+
<button class="btn btn-primary dropdown-toggle js-tooltip" data-toggle="dropdown"
81+
title="Specify a format for the GET request">
82+
<span class="caret"></span>
83+
</button>
84+
<ul class="dropdown-menu">
85+
{% for format in available_formats %}
86+
<li>
87+
<a class="js-tooltip format-option"
88+
href='{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}'
89+
rel="nofollow"
90+
title="Make a GET request on the {{ name }} resource with the format set to `{{ format }}`">
91+
{{ format }}
92+
</a>
93+
</li>
94+
{% endfor %}
95+
</ul>
96+
</div>
97+
</fieldset>
98+
</form>
99+
{% endif %}
100+
101+
{% if options_form %}
102+
<form class="button-form pull-right" action="{{ request.get_full_path }}" method="POST">
103+
{% csrf_token %} <input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
104+
value="OPTIONS" />
105+
<button class="btn btn-primary js-tooltip"
106+
title="Make an OPTIONS request on the {{ name }} resource">OPTIONS
107+
</button>
108+
</form>
109+
{% endif %}
110+
111+
{% if delete_form %}
112+
<form class="button-form" action="{{ request.get_full_path }}" method="POST">
113+
{% csrf_token %} <input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
114+
value="DELETE" />
115+
<button class="btn btn-danger js-tooltip"
116+
title="Make a DELETE request on the {{ name }} resource">DELETE
117+
</button>
118+
</form>
119+
{% endif %}
120+
</div>
121+
{% endif %}
122+
123+
<div class="content-main">
124+
<div class="page-header">
125+
<h1>{{ name }}</h1>
126+
</div>
127+
{% block description %}
128+
{{ description }}
129+
{% endblock %}
130+
<div class="request-info" style="clear: both">
131+
<pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
132+
</div>
133+
<div class="response-info">
134+
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
135+
{% for key, val in response_headers.items %}<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>
136+
{% endfor %}
137+
</span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
138+
</div>
139+
</div>
140+
</div>
141+
142+
{% if display_edit_forms %}
143+
144+
{% if post_form or raw_data_post_form %}
145+
<div {% if post_form %}class="tabbable"{% endif %}>
146+
{% if post_form %}
147+
<ul class="nav nav-tabs form-switcher">
148+
<li>
149+
<a name='html-tab' href="#object-form" data-toggle="tab">HTML form</a>
150+
</li>
151+
<li>
152+
<a name='raw-tab' href="#generic-content-form" data-toggle="tab">Raw data</a>
153+
</li>
154+
</ul>
155+
{% endif %}
156+
<div class="well tab-content">
157+
{% if post_form %}
158+
<div class="tab-pane" id="object-form">
159+
{% with form=post_form %}
160+
<form action="{{ request.get_full_path }}"
161+
method="POST" enctype="multipart/form-data" class="form-horizontal">
162+
<fieldset>
163+
{{ post_form }}
164+
<div class="form-actions">
165+
<button class="btn btn-primary"
166+
title="Make a POST request on the {{ name }} resource">POST
167+
</button>
168+
</div>
169+
</fieldset>
170+
</form>
171+
{% endwith %}
172+
</div>
173+
{% endif %}
174+
<div {% if post_form %}class="tab-pane"{% endif %} id="generic-content-form">
175+
{% with form=raw_data_post_form %}
176+
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
177+
<fieldset>
178+
{% include "rest_framework/raw_data_form.html" %}
179+
<div class="form-actions">
180+
<button class="btn btn-primary"
181+
title="Make a POST request on the {{ name }} resource">POST
182+
</button>
183+
</div>
184+
</fieldset>
185+
</form>
186+
{% endwith %}
187+
</div>
188+
</div>
189+
</div>
190+
{% endif %}
191+
192+
{% if put_form or raw_data_put_form or raw_data_patch_form %}
193+
<div {% if put_form %}class="tabbable"{% endif %}>
194+
{% if put_form %}
195+
<ul class="nav nav-tabs form-switcher">
196+
<li>
197+
<a name='html-tab' href="#object-form" data-toggle="tab">HTML form</a>
198+
</li>
199+
<li>
200+
<a name='raw-tab' href="#generic-content-form" data-toggle="tab">Raw data</a>
201+
</li>
202+
</ul>
203+
{% endif %}
204+
<div class="well tab-content">
205+
{% if put_form %}
206+
<div class="tab-pane" id="object-form">
207+
<form action="{{ request.get_full_path }}"
208+
method="POST" enctype="multipart/form-data" class="form-horizontal">
209+
<fieldset>
210+
{{ put_form }}
211+
<div class="form-actions">
212+
<button class="btn btn-primary js-tooltip"
213+
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
214+
value="PUT" title="Make a PUT request on the {{ name }} resource">
215+
PUT
216+
</button>
217+
</div>
218+
</fieldset>
219+
</form>
220+
</div>
221+
{% endif %}
222+
<div {% if put_form %}class="tab-pane"{% endif %} id="generic-content-form">
223+
{% with form=raw_data_put_or_patch_form %}
224+
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
225+
<fieldset>
226+
{% include "rest_framework/raw_data_form.html" %}
227+
<div class="form-actions">
228+
{% if raw_data_put_form %}
229+
<button class="btn btn-primary js-tooltip"
230+
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
231+
value="PUT" title="Make a PUT request on the {{ name }} resource">
232+
PUT
233+
</button>
234+
{% endif %}
235+
{% if raw_data_patch_form %}
236+
<button class="btn btn-primary js-tooltip"
237+
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
238+
value="PATCH"
239+
title="Make a PATCH request on the {{ name }} resource">PATCH
240+
</button>
241+
{% endif %}
242+
</div>
243+
</fieldset>
244+
</form>
245+
{% endwith %}
246+
</div>
247+
</div>
248+
</div>
249+
{% endif %}
250+
{% endif %}
251+
</div>
252+
<!-- END Content -->
253+
</div>
254+
{% endblock %}
255+
{% block custom_js %}
256+
<script src="{% static "rest_framework/js/prettify-min.js" %}"></script>
257+
<script src="{% static "rest_framework/js/default.js" %}"></script>
258+
{% endblock custom_js %}
259+

web/tests/test_event_views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,9 @@ def test_geoip_invalid_ip(db, client):
247247

248248
assert 'List all events' in response.content
249249
assert 'List all events <span' not in response.content
250+
251+
@pytest.mark.django_db
252+
def test_list_events_for_country_code(db, client):
253+
response = client.get(reverse('web.view_event_by_country', args=['SI']))
254+
255+
assert response.status_code == 200

web/views/events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def view_event_by_country(request, country_code):
186186
return render_to_response(
187187
'pages/list_events.html', {
188188
'event_list': event_list,
189+
'country_code': country_code,
189190
}, context_instance=RequestContext(request))
190191

191192

0 commit comments

Comments
 (0)