?
Merge branch 'main' of github.com:guntherweissenbaeck/django_fbf
This commit is contained in:
commit
f8c1482ef8
18 changed files with 154 additions and 190 deletions
|
@ -1,29 +0,0 @@
|
|||
# Generated by Django 4.2.6 on 2023-10-09 21:31
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Aviary',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('description', models.CharField(max_length=256, unique=True, verbose_name='Beschreibung')),
|
||||
('condition', models.CharField(choices=[('Offen', 'Offen'), ('Geschlossen', 'Geschlossen'), ('Gesperrt', 'Gesperrt')], max_length=256, verbose_name='Zustand')),
|
||||
('last_ward_round', models.DateField(verbose_name='letzte Visite')),
|
||||
('comment', models.CharField(blank=True, max_length=512, null=True, verbose_name='Bemerkungen')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Voliere',
|
||||
'verbose_name_plural': 'Volieren',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1,81 +0,0 @@
|
|||
# Generated by Django 4.2.6 on 2023-10-09 21:31
|
||||
|
||||
import ckeditor.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('aviary', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Bird',
|
||||
fields=[
|
||||
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=256, unique=True, verbose_name='Bezeichnung')),
|
||||
('description', ckeditor.fields.RichTextField(verbose_name='Erläuterungen')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Vogel',
|
||||
'verbose_name_plural': 'Vögel',
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='BirdStatus',
|
||||
fields=[
|
||||
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||
('description', models.CharField(max_length=256, unique=True, verbose_name='Bezeichnung')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Patientenstatus',
|
||||
'verbose_name_plural': 'Patientenstatus',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Circumstance',
|
||||
fields=[
|
||||
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||
('description', models.CharField(max_length=256, verbose_name='Bezeichnung')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Fundumstand',
|
||||
'verbose_name_plural': 'Fundumstände',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='FallenBird',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('bird_identifier', models.CharField(max_length=256, verbose_name='Patienten Alias')),
|
||||
('age', models.CharField(choices=[('unbekannt', 'unbekannt'), ('Ei', 'Ei'), ('Nestling', 'Nestling'), ('Ästling', 'Ästling'), ('Juvenil', 'Juvenil'), ('Adult', 'Adult')], max_length=15, verbose_name='Alter')),
|
||||
('sex', models.CharField(choices=[('Weiblich', 'Weiblich'), ('Männlich', 'Männlich'), ('Unbekannt', 'Unbekannt')], max_length=15, verbose_name='Geschlecht')),
|
||||
('date_found', models.DateField(verbose_name='Datum des Fundes')),
|
||||
('place', models.CharField(max_length=256, verbose_name='Ort des Fundes')),
|
||||
('created', models.DateTimeField(auto_now_add=True, verbose_name='angelegt am')),
|
||||
('updated', models.DateTimeField(auto_now=True, verbose_name='geändert am')),
|
||||
('diagnostic_finding', models.CharField(max_length=256, verbose_name='Diagnose bei Fund')),
|
||||
('sent_to', models.CharField(blank=True, max_length=256, null=True, verbose_name='Übersandt nach')),
|
||||
('comment', models.TextField(blank=True, null=True, verbose_name='Bemerkungen')),
|
||||
('finder', models.TextField(blank=True, null=True, verbose_name='Finder')),
|
||||
('aviary', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='aviary.aviary', verbose_name='Voliere')),
|
||||
('bird', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bird.bird', verbose_name='Vogel')),
|
||||
('find_circumstances', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bird.circumstance', verbose_name='Fundumstände')),
|
||||
('status', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='bird.birdstatus')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Benutzer')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Patient',
|
||||
'verbose_name_plural': 'Patienten',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 4.2.6 on 2023-10-10 06:34
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bird', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='fallenbird',
|
||||
name='comment',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='Bemerkung'),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 4.2.6 on 2023-10-11 15:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bird', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='fallenbird',
|
||||
name='comment',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='Bemerkung'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='fallenbird',
|
||||
name='finder',
|
||||
field=models.TextField(blank=True, default='Vorname:\nName:\\Straße und Hausnummer:\\PLZ:\\Ort', null=True, verbose_name='Finder'),
|
||||
),
|
||||
]
|
0
app/contact/__init__.py
Normal file
0
app/contact/__init__.py
Normal file
15
app/contact/admin.py
Normal file
15
app/contact/admin.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Contact
|
||||
|
||||
|
||||
@admin.register(Contact)
|
||||
class FallenBirdAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"name",
|
||||
"phone",
|
||||
"email",
|
||||
"address",
|
||||
"comment",
|
||||
]
|
||||
list_filter = ("name", "phone", "email", "address", "comment")
|
8
app/contact/apps.py
Normal file
8
app/contact/apps.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class ContactConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "contact"
|
||||
verbose_name = _("Kontakte")
|
0
app/contact/migrations/__init__.py
Normal file
0
app/contact/migrations/__init__.py
Normal file
27
app/contact/models.py
Normal file
27
app/contact/models.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from django.db import models
|
||||
from uuid import uuid4
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class Contact(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||
name = models.CharField(
|
||||
max_length=50, null=True, blank=True, verbose_name=_("Kontakt Name")
|
||||
)
|
||||
phone = models.CharField(
|
||||
max_length=50, null=True, blank=True, verbose_name=_("Telefon")
|
||||
)
|
||||
email = models.CharField(
|
||||
max_length=50, null=True, blank=True, verbose_name=_("Email")
|
||||
)
|
||||
address = models.CharField(
|
||||
max_length=50, null=True, blank=True, verbose_name=_("Adresse")
|
||||
)
|
||||
comment = models.CharField(
|
||||
max_length=50, null=True, blank=True, verbose_name=_("Bemerkungen")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Kontakt")
|
||||
verbose_name_plural = _("Kontakte")
|
75
app/contact/templates/contact/contact_all.html
Normal file
75
app/contact/templates/contact/contact_all.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% block header %}
|
||||
<!-- Datatable CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.bootstrap5.min.css">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
|
||||
|
||||
<!-- Datatable jQuery -->
|
||||
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.9/js/responsive.bootstrap5.min.js"></script>
|
||||
|
||||
<!-- Configure the DataTable. -->
|
||||
<script nonce="{{ request.csp_nonce }}">
|
||||
$(document).ready(function () {
|
||||
let table = $('#t__contact_all').DataTable({
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.11.3/i18n/de_de.json',
|
||||
},
|
||||
paging: true,
|
||||
info: true,
|
||||
"pagingType": "first_last_numbers",
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
order: [[2, 'desc']],
|
||||
columnDefs: [
|
||||
{ responsivePriority: 1, targets: 0 },
|
||||
]
|
||||
});
|
||||
table.on( 'responsive-display', function ( e, datatable, row, showHide, update ) {
|
||||
table.rows().every( function () {
|
||||
if (showHide && row.index() !== this.index() && this.child.isShown()) {
|
||||
$('td', this.node()).eq(0).click();
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{% endblock header %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Übersicht aller Kontakte</h3>
|
||||
<p>Die Übersicht aller bisher hinterlegten Kontakte.</p>
|
||||
|
||||
<table class="table table-striped table-hover display responsive nowrap" width="100%" id="t__contact_all">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Telefon</th>
|
||||
<th>Email</th>
|
||||
<th>Adresse</th>
|
||||
<th>Bemerkung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in contacts %}
|
||||
<tr>
|
||||
<td> {{ item.name }} </td>
|
||||
<td> {{ item.phone|default_if_none:"" }}</td>
|
||||
<td> {{ item.email|default_if_none:"" }} </td>
|
||||
<td> {{ item.address|default_if_none:"" }} </td>
|
||||
<td> {{ item.comment|default_if_none:"" }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock content %}
|
||||
|
3
app/contact/tests.py
Normal file
3
app/contact/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
7
app/contact/urls.py
Normal file
7
app/contact/urls.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.urls import path
|
||||
|
||||
from .views import contact_all
|
||||
|
||||
urlpatterns = [
|
||||
path("", contact_all, name="contact_all"),
|
||||
]
|
11
app/contact/views.py
Normal file
11
app/contact/views.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from django.shortcuts import render
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from .models import Contact
|
||||
|
||||
|
||||
@login_required(login_url="account_login")
|
||||
def contact_all(request):
|
||||
contacts = Contact.objects.all()
|
||||
context = {"contacts": contacts}
|
||||
return render(request, "contact/contact_all.html", context)
|
|
@ -25,7 +25,7 @@ JAZZMIN_SETTINGS = {
|
|||
"search_model": [
|
||||
"aviary.Aviary",
|
||||
"bird.FallenBird",
|
||||
"bird.User",
|
||||
# "bird.User",
|
||||
],
|
||||
# Field name on user model that contains avatar ImageField/URLField/Charfield or a callable that receives the user
|
||||
# "user_avatar": None,
|
||||
|
@ -86,10 +86,7 @@ JAZZMIN_SETTINGS = {
|
|||
"bird.Circumstance": "fas fa-solid fa-ring",
|
||||
"bird.FallenBird": "fas fa-solid fa-bed",
|
||||
"costs.Costs": "fas fa-solid fa-money-bill",
|
||||
# "rescuer.Rescuer": "fas fa-solid fa-user-shield",
|
||||
"socialaccount.socialaccount": "fas fa-solid fa-lock",
|
||||
"socialaccount.socialapp": "fas fa-solid fa-laptop",
|
||||
"socialaccount.socialtoken": "fas fa-solid fa-keyboard",
|
||||
"contact.Contact": "fas fa-solid fa-address-card",
|
||||
},
|
||||
# Icons that are used when one is not manually specified
|
||||
# "default_icon_parents": "fas fa-chevron-circle-right",
|
||||
|
|
|
@ -83,6 +83,7 @@ INSTALLED_APPS = [
|
|||
# -----------------------------------
|
||||
"aviary",
|
||||
"bird",
|
||||
"contact",
|
||||
"costs",
|
||||
"export",
|
||||
]
|
||||
|
|
|
@ -7,6 +7,7 @@ urlpatterns = [
|
|||
path("", views.bird_all, name="index"),
|
||||
path("aviary/", include("aviary.urls")),
|
||||
path("bird/", include("bird.urls")),
|
||||
path("contacts/", include("contact.urls")),
|
||||
path("costs/", include("costs.urls")),
|
||||
path("export/", include("export.urls")),
|
||||
# Admin
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# Generated by Django 4.2.6 on 2023-10-09 21:31
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('bird', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Costs',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('costs', models.DecimalField(decimal_places=2, default='0.00', max_digits=5, verbose_name='Betrag')),
|
||||
('created', models.DateField(verbose_name='Gebucht am')),
|
||||
('comment', models.CharField(blank=True, max_length=512, null=True, verbose_name='Bemerkungen')),
|
||||
('id_bird', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='bird.fallenbird', verbose_name='Patient')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Benutzer')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Kosten',
|
||||
'verbose_name_plural': 'Kosten',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -32,6 +32,10 @@
|
|||
<a class="nav-link {% if '/costs/all' in request.path %} active {% endif %}"
|
||||
href="{% url 'costs_all' %}">alle Kosten</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if '/contacts' in request.path %} active {% endif %}"
|
||||
href="{% url 'contact_all' %}">Kontakte</a>
|
||||
</li>
|
||||
|
||||
{% if request.user|group_check:"data-export" %}
|
||||
<li class="nav-item">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue