Skip to content

Commit aeed8eb

Browse files
committed
ticket#1 add view, templates, initial_data
1 parent 51356c2 commit aeed8eb

4 files changed

Lines changed: 76 additions & 3 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ {"pk": 1,
2+
"model": "hello.contact",
3+
"fields": {"bio": "Python Dev",
4+
"name": "Oleksii",
5+
"other_contact": "https://github.com/skl1f",
6+
"lastname": "Miroshnychenko",
7+
"date_of_birth": "1991-04-01",
8+
"skype": "sklifeg",
9+
"jabber": "skl1f@42cc.co",
10+
"email": "skl1f@ukrgadget.com"}}
11+
]

apps/hello/templates/index.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{% load staticfiles %}
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
9+
<title>Main Page | 42-test-skl1f</title>
10+
11+
<!-- Bootstrap -->
12+
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
13+
14+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
15+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
16+
<!--[if lt IE 9]>
17+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
18+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
19+
<![endif]-->
20+
</head>
21+
<body>
22+
<div class="container-fluid">
23+
<div class="row">
24+
<div class="col-md-6">
25+
<h1>42 Coffee Cups Test Assignment</h1>
26+
</div>
27+
</div>
28+
<div class="row">
29+
<div class="col-md-6"><h2>About me:</h2>
30+
<ul class="list-unstyled">
31+
<li>Name: {{ contact.name }}</li>
32+
<li>Last Name: {{ contact.lastname }}</li>
33+
<li>Bio: {{ contact.bio }}</li>
34+
</ul>
35+
</div>
36+
<div class="col-md-6"><h2>Contacts:</h2>
37+
<ul class="list-unstyled">
38+
<li>Email: {{ contact.email }}</li>
39+
<li>Jabber: {{ contact.jabber }}</li>
40+
<li>Skype: {{ contact.skype }}</li>
41+
<li>Other contact: {{ contact.other_contact }}</li>
42+
</ul></div>
43+
</div>
44+
<div class="row">
45+
</div>
46+
</div>
47+
48+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
49+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
50+
<!-- Include all compiled plugins (below), or include individual files as needed -->
51+
<script src="{% static "js/bootstrap.min.js" %}"></script>
52+
</body>
53+
</html>

apps/hello/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
from django.shortcuts import render
2+
from .models import Contact
23

3-
# Create your views here.
4+
5+
def home(request):
6+
contact = Contact.objects.get(id=1)
7+
return render(request, 'index.html', {'contact': contact},
8+
content_type="text/html")
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
from .common import *
1+
# flake8: noqa
2+
3+
from .common import *
4+
25
try:
3-
from .local import *
6+
from .local import *
7+
48
except ImportError:
59
pass

0 commit comments

Comments
 (0)