added bootstrap
This commit is contained in:
parent
1962761beb
commit
b9b568c31f
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2023-12-19 16:48
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('sourcePerson', '0002_auto_20231129_1829'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='sourceperson',
|
||||||
|
name='created_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2023, 12, 19, 16, 48, 48, 328450, tzinfo=datetime.timezone.utc)),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='sourceperson',
|
||||||
|
name='updated_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2023, 12, 19, 16, 48, 48, 328467, tzinfo=datetime.timezone.utc)),
|
||||||
|
),
|
||||||
|
]
|
||||||
3
sourcePerson/templates/create.html
Normal file
3
sourcePerson/templates/create.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{% extends "header.html" %}
|
||||||
|
|
||||||
|
{% block title %}Person anlegen{% endblock %}
|
||||||
31
sourcePerson/templates/header.html
Normal file
31
sourcePerson/templates/header.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{% load bootstrap5 %}
|
||||||
|
{% bootstrap_css %}
|
||||||
|
{% bootstrap_javascript %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{% block title %} Quote Me {% endblock %}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Link</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link disabled" href="#">Disabled</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<main class="container">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
sourcePerson/templates/list.html
Normal file
28
sourcePerson/templates/list.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{% extends "header.html" %}
|
||||||
|
|
||||||
|
{% block title %}Personlist{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if persons %}
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Beschreibung</th>
|
||||||
|
<th scope="col">Aktiviert</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for person in persons %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ person.name }}</td>
|
||||||
|
<td>{{ person.description }}</td>
|
||||||
|
<td>{{ person.isActive}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{%else%}
|
||||||
|
Nothing found
|
||||||
|
{%endif%}
|
||||||
|
{% endblock %}
|
||||||
@ -1,6 +1,9 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
from . import views
|
from . import views
|
||||||
|
from . import models
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("create", views.ping)
|
path("create", TemplateView.as_view(template_name="create.html"), name="create"),
|
||||||
|
path("list", views.listPersons, name="list")
|
||||||
]
|
]
|
||||||
@ -1,11 +1,14 @@
|
|||||||
from rest_framework.decorators import api_view, permission_classes
|
from rest_framework.decorators import api_view, permission_classes
|
||||||
|
from django.shortcuts import render
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
|
from . import models
|
||||||
|
|
||||||
|
def listPersons(request, **kwargs):
|
||||||
|
persons = models.sourcePerson.objects.all()
|
||||||
|
data = {
|
||||||
|
"persons": persons
|
||||||
|
}
|
||||||
|
|
||||||
# Create your views here.
|
return render(request, 'list.html', data)
|
||||||
@api_view(["GET"])
|
|
||||||
@csrf_exempt
|
|
||||||
def ping(request):
|
|
||||||
content = {"message": "pong"}
|
|
||||||
return JsonResponse(content)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user