Add home page

This commit is contained in:
Gabriel Augendre 2018-05-21 21:03:08 +02:00
parent 93b6c7ba11
commit 8776e6a8af
8 changed files with 58 additions and 4 deletions

View 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')),
],
),
]

View file

@ -2,4 +2,5 @@ from django.db import models
class Teacher(models.Model):
first_name = models.CharField()
# first_name = models.CharField()
pass

View 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>

View file

@ -0,0 +1,6 @@
{% extends 'manuels/base.html' %}
{% block title %}Accueil{% endblock %}
{% block content %}
{% endblock %}

View file

@ -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')

View file

@ -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'

View file

@ -51,6 +51,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap4',
'manuels',
]
MIDDLEWARE = [

View file

@ -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'),
]