]> git.menne-pb.de Git - pinpoint.git/commitdiff
Readd first view + some documentation
authorJörn Menne <jmenne@fedora.de>
Wed, 5 Feb 2025 20:58:58 +0000 (21:58 +0100)
committerJörn Menne <jmenne@fedora.de>
Wed, 5 Feb 2025 20:58:58 +0000 (21:58 +0100)
doc-requirements.txt
doc/conf.py
doc/georeport/views.rst [new file with mode: 0644]
doc/index.rst
doc/info/model-info.rst [new file with mode: 0644]
georeport/static/georeport/mapsetup.js [new file with mode: 0644]
georeport/static/georeport/style.css [new file with mode: 0644]
georeport/templates/georeport/base.html [new file with mode: 0644]
georeport/views.py

index ca4d1eaf490c0fcda0b3f064914d933e1bc91e58..5c715ca32437222381a89aecb101acde605d5386 100644 (file)
@@ -1,3 +1,4 @@
 sphinx 
 sphinxcontrib-plantuml
+sphinxcontrib-mermaid
 -r requirements.txt
index 743f6172cc1dea7a670d1e477a08e8cc9ef9f062..48dcf9cdd5dd9f4e8b6884fca9a34be489791418 100644 (file)
@@ -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 (file)
index 0000000..0674cbd
--- /dev/null
@@ -0,0 +1,7 @@
+Views
+=====
+..
+    In django views, respond to the http request and create the response. 
+
+.. automodule:: georeport.views
+   :members:
index ed6580e047642a8c75280aec17f117a82e9950b4..295a0864bf510954a0542ece5d7b8b026dc0d7b5 100644 (file)
@@ -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 (file)
index 0000000..5f402d8
--- /dev/null
@@ -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 (file)
index 0000000..de15e51
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * Copyright: (c) 2025, Jörn Menne <jmenne@posteo.de>
+ * 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: "&copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>"
+}).addTo(map);
diff --git a/georeport/static/georeport/style.css b/georeport/static/georeport/style.css
new file mode 100644 (file)
index 0000000..ecad1ba
--- /dev/null
@@ -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 (file)
index 0000000..0fbeb6f
--- /dev/null
@@ -0,0 +1,28 @@
+
+<!--
+Copyright: (c) 2025, Jörn Menne <jmenne@posteo.de>
+GNU General Public License v3.0 (see LICSENE or https://www.gnu.org/license/gpl-3.0.md)
+-->
+<!DOCTYPE html>
+{% load static %}
+<html>
+    <head>
+        <title>Pinpoint-Report</title>
+        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
+            integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
+            crossorigin=""/>
+
+        <!-- Make sure you put this AFTER Leaflet's CSS -->
+        <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
+            integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
+            crossorigin="">
+        </script>
+        <link rel="stylesheet" href="{% static 'georeport/style.css' %}"/>
+    </head>
+    <body>
+        <h1>Pinpoint-Report</h1>
+        <div id="map"></div>
+        <script src="{% static 'georeport/mapsetup.js' %}"> </script>
+    </body>
+</html>
+
index 4da908d3e534d849461352bdb3542cae57cb516f..eb5c355ac0581a8fcc72218298cee15a3b3c098a 100644 (file)
@@ -1,16 +1,31 @@
-# Create your views here.
+# Copyright: (c) 2025, Jörn Menne <jmenne@posteo.de>
+# 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