Add home page
This commit is contained in:
parent
93b6c7ba11
commit
8776e6a8af
8 changed files with 58 additions and 4 deletions
20
manuels/migrations/0001_initial.py
Normal file
20
manuels/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 2.0.5 on 2018-05-21 18:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Teacher',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -2,4 +2,5 @@ from django.db import models
|
|||
|
||||
|
||||
class Teacher(models.Model):
|
||||
first_name = models.CharField()
|
||||
# first_name = models.CharField()
|
||||
pass
|
||||
|
|
13
manuels/templates/manuels/base.html
Normal file
13
manuels/templates/manuels/base.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Manuels - {% block title %}{% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
6
manuels/templates/manuels/home_page.html
Normal file
6
manuels/templates/manuels/home_page.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{% extends 'manuels/base.html' %}
|
||||
{% block title %}Accueil{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
|
@ -1,3 +1,7 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
||||
class HomePageTest(TestCase):
|
||||
def test_home_page_returns_correct_html(self):
|
||||
response = self.client.get('/')
|
||||
self.assertTemplateUsed(response, 'manuels/home_page.html')
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
from django.shortcuts import render
|
||||
from django.views.generic import CreateView
|
||||
|
||||
# Create your views here.
|
||||
from manuels.models import Teacher
|
||||
|
||||
|
||||
class HomePageView(CreateView):
|
||||
model = Teacher
|
||||
fields = []
|
||||
template_name = 'manuels/home_page.html'
|
||||
|
|
|
@ -51,6 +51,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'bootstrap4',
|
||||
'manuels',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
|
@ -16,6 +16,9 @@ Including another URLconf
|
|||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from manuels.views import HomePageView
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', HomePageView.as_view(), name='home_page'),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue