From: Jörn Menne Date: Wed, 5 Feb 2025 20:58:58 +0000 (+0100) Subject: Readd first view + some documentation X-Git-Url: https://git.menne-pb.de/?a=commitdiff_plain;h=6b0e7668bf119e9230b143abf54939f39536516a;p=pinpoint.git Readd first view + some documentation --- diff --git a/doc-requirements.txt b/doc-requirements.txt index ca4d1ea..5c715ca 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -1,3 +1,4 @@ sphinx sphinxcontrib-plantuml +sphinxcontrib-mermaid -r requirements.txt diff --git a/doc/conf.py b/doc/conf.py index 743f617..48dcf9c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -26,6 +26,7 @@ extensions = [ "sphinx.ext.duration", "sphinx.ext.napoleon", "sphinxcontrib.plantuml", + "sphinxcontrib.mermaid", "sphinx.ext.mathjax", "myst_parser", "sphinx.ext.todo", diff --git a/doc/georeport/views.rst b/doc/georeport/views.rst new file mode 100644 index 0000000..0674cbd --- /dev/null +++ b/doc/georeport/views.rst @@ -0,0 +1,7 @@ +Views +===== +.. + In django views, respond to the http request and create the response. + +.. automodule:: georeport.views + :members: diff --git a/doc/index.rst b/doc/index.rst index ed6580e..295a086 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -16,6 +16,9 @@ documentation for details. :caption: Contents: georeport/models - + georeport/views + + + info/model-info .. todolist:: diff --git a/doc/info/model-info.rst b/doc/info/model-info.rst new file mode 100644 index 0000000..5f402d8 --- /dev/null +++ b/doc/info/model-info.rst @@ -0,0 +1,48 @@ +Model-Info +========== + +Models describe the data-structure of the database. + +In this project, there are two main models, which are called **Category** and **Report**. + +The report-model contains request, provided by an user. + +The reports are grouped by categories. +Furthermore the category also handles access to the reports. This is done by checking if a +user corresponds with a category and only if this is the case,the user gets access to the category and the +reports. + +The structure of the database is shown in the following diagram. + + +.. mermaid:: + + erDiagram + Report{ + string title + string description + datetime creation_time + dateimte updated_at + boolean published + int state + email email + } + Category{ + string name + } + Location{ + float Latitude + float Longitude + } + Image + User + Group + Report }o--|| Category : "belongs to" + Report }| -- || Location: "is at" + Report || -- o{ Image: "has" + Category |o--o{Category: "Parent of" + User }o--o{ Group : "is in" + User }o--o{ Category: "owns" + Group }o--o{ Category: "owns" + + diff --git a/georeport/static/georeport/mapsetup.js b/georeport/static/georeport/mapsetup.js new file mode 100644 index 0000000..de15e51 --- /dev/null +++ b/georeport/static/georeport/mapsetup.js @@ -0,0 +1,10 @@ +/* + * Copyright: (c) 2025, Jörn Menne + * GNU General Public License v3.0 (see LICSENE or https://www.gnu.org/license/gpl-3.0.md) +*/ +// Center the map-view on Paderborn and use openstreetmap as a mapservice +var map = L.map("map").setView([51.7173, 8.753557], 15); +L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", { + maxZoom: 19, + attribution: "© OpenStreetMap" +}).addTo(map); diff --git a/georeport/static/georeport/style.css b/georeport/static/georeport/style.css new file mode 100644 index 0000000..ecad1ba --- /dev/null +++ b/georeport/static/georeport/style.css @@ -0,0 +1,3 @@ +#map { + height: 500px; +} diff --git a/georeport/templates/georeport/base.html b/georeport/templates/georeport/base.html new file mode 100644 index 0000000..0fbeb6f --- /dev/null +++ b/georeport/templates/georeport/base.html @@ -0,0 +1,28 @@ + + + +{% load static %} + + + Pinpoint-Report + + + + + + + +

Pinpoint-Report

+
+ + + + diff --git a/georeport/views.py b/georeport/views.py index 4da908d..eb5c355 100644 --- a/georeport/views.py +++ b/georeport/views.py @@ -1,16 +1,31 @@ -# Create your views here. +# Copyright: (c) 2025, Jörn Menne +# GNU General Public License v3.0 (see LICSENE or https://www.gnu.org/license/gpl-3.0.md) + +""" +Module containing the django-views. +Each view is associated with a url in urls.py. +A view takes a request and creates a respond for the request. +""" + +from django.shortcuts import render +from django.views.decorators.http import require_safe + + +@require_safe +def index(request): + """ + Function which handles request going to "/georeport". + """ + return render(request, "georeport/index.html") + -# TODO: Index-Views # TODO: Category-List -# TODO: Report-List -# TODO: Create-Report -# TODO: DetailView # TODO: Category-Detail -# TODO: Supcategories - +# TODO: Subcategories -from django.http import HttpResponse +# TODO: Report-List +# TODO: Create-Report +# TODO: Detailview Report -def index(request): - return HttpResponse(b"Pinpoint-Report") +# TODO: Finish Link