diff --git a/.env.sample b/.env.sample
new file mode 100644
index 0000000..e69de29
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2eea525
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.env
\ No newline at end of file
diff --git a/Pipfile b/Pipfile
index 882c69e..c9803e2 100644
--- a/Pipfile
+++ b/Pipfile
@@ -8,6 +8,7 @@ verify_ssl = true
[packages]
django = "*"
psycopg2-binary = "*"
+django-extensions = "*"
[requires]
python_version = "3.8"
diff --git a/Pipfile.lock b/Pipfile.lock
index 2f7d2d8..ee0359e 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "b04c44c86eca3e486ef2ab4a9a08c9c2c1531422cfe0123e55023fb1b157effc"
+ "sha256": "787971d93a72d315fb906991a877356e209592be55f6f0fa79f09bc68e93848b"
},
"pipfile-spec": 6,
"requires": {
@@ -32,6 +32,14 @@
"index": "pypi",
"version": "==3.1.2"
},
+ "django-extensions": {
+ "hashes": [
+ "sha256:6809c89ca952f0e08d4e0766bc0101dfaf508d7649aced1180c091d737046ea7",
+ "sha256:dc663652ac9460fd06580a973576820430c6d428720e874ae46b041fa63e0efa"
+ ],
+ "index": "pypi",
+ "version": "==3.0.9"
+ },
"psycopg2-binary": {
"hashes": [
"sha256:0deac2af1a587ae12836aa07970f5cb91964f05a7c6cdb69d8425ff4c15d4e2c",
diff --git a/contacts/admin.py b/contacts/admin.py
index 8c38f3f..c5e4edc 100644
--- a/contacts/admin.py
+++ b/contacts/admin.py
@@ -1,3 +1,5 @@
from django.contrib import admin
+from .models import Contact
# Register your models here.
+admin.site.register(Contact)
\ No newline at end of file
diff --git a/contacts/forms.py b/contacts/forms.py
new file mode 100644
index 0000000..78d33eb
--- /dev/null
+++ b/contacts/forms.py
@@ -0,0 +1,7 @@
+from django import forms
+from .models import Contact
+
+class ContactForm(forms.modelForm):
+ class Meta:
+ model = Contact
+ fields = ('name', 'age',)
\ No newline at end of file
diff --git a/contacts/static/css/styles.css b/contacts/static/css/styles.css
new file mode 100644
index 0000000..eb6a775
--- /dev/null
+++ b/contacts/static/css/styles.css
@@ -0,0 +1,3 @@
+body {
+ font-family: Arial, Helvetica, sans-serif;
+}
\ No newline at end of file
diff --git a/contacts/templates/contacts/base.html b/contacts/templates/contacts/base.html
new file mode 100644
index 0000000..df9f3df
--- /dev/null
+++ b/contacts/templates/contacts/base.html
@@ -0,0 +1,15 @@
+{% load static %}
+
+
+
+
+
+ Contacts
+
+
+
+ Phonebook
+
+ {% block content %} {% endblock %}
+
+
\ No newline at end of file
diff --git a/contacts/templates/contacts/contact_detail.html b/contacts/templates/contacts/contact_detail.html
new file mode 100644
index 0000000..535d108
--- /dev/null
+++ b/contacts/templates/contacts/contact_detail.html
@@ -0,0 +1,6 @@
+
+{% extends 'contacts/base.html' %} {% block content %}
+
+{{ contact.name }} (edit)
+Age: {{ contact.age }}
+{% endblock %}
\ No newline at end of file
diff --git a/contacts/templates/contacts/contact_list.html b/contacts/templates/contacts/contact_list.html
new file mode 100644
index 0000000..dec0996
--- /dev/null
+++ b/contacts/templates/contacts/contact_list.html
@@ -0,0 +1,12 @@
+
+{% extends 'contacts/base.html' %} {% block content %}
+
+Contacts (+)
+
+{% endblock %}
\ No newline at end of file
diff --git a/contacts/urls.py b/contacts/urls.py
new file mode 100644
index 0000000..a381040
--- /dev/null
+++ b/contacts/urls.py
@@ -0,0 +1,7 @@
+from django.urls import path
+from . import views
+
+urlpatterns = [
+ path('', views.contact_list, name='contact_list'),
+ path('contacts/', views.contact_detail, name='contact_detail'),
+]
\ No newline at end of file
diff --git a/contacts/views.py b/contacts/views.py
index 91ea44a..a37f7e4 100644
--- a/contacts/views.py
+++ b/contacts/views.py
@@ -1,3 +1,15 @@
from django.shortcuts import render
+from .models import Contact
+
# Create your views here.
+
+## index
+def contact_list(request):
+ contacts = Contact.objects.all()
+ return render(request, 'contacts/contact_list.html', { 'contacts': contacts})
+
+## show
+def contact_detail(request, pk):
+ contact = Contact.objects.get(id=pk)
+ return render(request, 'contacts/contact_detail.html', {'contact': contact})
\ No newline at end of file
diff --git a/django_contacts/settings.py b/django_contacts/settings.py
index fdc5afd..b25e3fc 100644
--- a/django_contacts/settings.py
+++ b/django_contacts/settings.py
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'django_extensions',
'contacts'
]
diff --git a/django_contacts/urls.py b/django_contacts/urls.py
index f4b4032..7609bf6 100644
--- a/django_contacts/urls.py
+++ b/django_contacts/urls.py
@@ -13,9 +13,11 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
+from django.conf.urls import include
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
+ path('', include('contacts.urls')),
]