Prvi commit

This commit is contained in:
2024-01-08 11:59:58 +01:00
commit c001ebe3e0
18 changed files with 271 additions and 0 deletions

View File

View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class PlovidbaAplikacijaConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'plovidba_aplikacija'

View File

@@ -0,0 +1,12 @@
from django.db import models
# Create your models here.
from django.contrib.gis.db import models
class ObjektSigurnosti(models.Model):
lokacija = models.PointField()
naziv = models.CharField(max_length=255)

View File

@@ -0,0 +1,9 @@
# serializers.py
from rest_framework import serializers
from .models import ObjektSigurnosti
class ObjektSigurnostiSerializer(serializers.ModelSerializer):
class Meta:
model = ObjektSigurnosti
fields = '__all__'

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,10 @@
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import ObjektSigurnostiViewSet
router = DefaultRouter()
router.register(r'objekti', ObjektSigurnostiViewSet, basename='objekt-sigurnosti')
urlpatterns = [
path('', include(router.urls)),
]

View File

@@ -0,0 +1,11 @@
from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from .models import ObjektSigurnosti
from .serializers import ObjektSigurnostiSerializer
class ObjektSigurnostiViewSet(viewsets.ModelViewSet):
queryset = ObjektSigurnosti.objects.all()
serializer_class = ObjektSigurnostiSerializer