Base tempalte and bootstrap4

This commit is contained in:
grisel-davy 2020-12-19 21:29:39 +01:00
parent 1f1226ee6c
commit 458e0aa846
6 changed files with 71 additions and 1 deletions

View file

@ -0,0 +1,24 @@
# Generated by Django 3.1.4 on 2020-12-19 17:43
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Slug',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(help_text='Slug of the new URL. Up to 20 caracters including letters, number, underscores and hyphens.', max_length=20)),
('destination', models.CharField(help_text='The destination URL, limited to 300 characters.', max_length=300)),
('uid', models.CharField(max_length=100, null=True)),
('date', models.DateTimeField(auto_now=True)),
],
),
]

View file

View file

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
""" """
from pathlib import Path from pathlib import Path
import os
from .local_settings import * from .local_settings import *
@ -31,6 +32,7 @@ ALLOWED_HOSTS = ['litl.auro.re',]
INSTALLED_APPS = [ INSTALLED_APPS = [
'litl', 'litl',
'bootstrap4',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
@ -54,7 +56,7 @@ ROOT_URLCONF = 'litl.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [os.path.join(BASE_DIR,'templates').replace("\\","/"),],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [

26
litl/templates/base.html Normal file
View file

@ -0,0 +1,26 @@
{% load bootstrap4 %}
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}
<div class="jumbotron text-center">
<h1>My First Bootstrap Page</h1>
<p>Resize this responsive page to see the effect!</p>
</div>
<div class="container">
<div class="row">
<div class="col-sm-4">
<h3>Column 1</h3>
<p>Lorem ipsum dolor..</p>
</div>
<div class="col-sm-4">
<h3>Column 2</h3>
<p>Lorem ipsum dolor..</p>
</div>
<div class="col-sm-4">
<h3>Column 3</h3>
<p>Lorem ipsum dolor..</p>
</div>
</div>
</div>

View file

@ -16,6 +16,9 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from .views import index
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', index, name="index"),
] ]

15
litl/views.py Normal file
View file

@ -0,0 +1,15 @@
# coding: utf-8
# Author: Grizzly
#
# Views for litl.
from django.shortcuts import render
from .settings import TEMPLATES
def index(request):
"""Display the home page of the site.
TODO: Search and display the urls shortened by the user in the past.
"""
context = {}
return render(request,'base.html',context)