Base django project

This commit is contained in:
Edgar P. Burkhart 2022-05-19 16:09:28 +02:00
commit 0b58580a00
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
16 changed files with 278 additions and 0 deletions

0
nummi/main/__init__.py Normal file
View file

3
nummi/main/admin.py Normal file
View file

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

6
nummi/main/apps.py Normal file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class MainConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "main"

View file

@ -0,0 +1,35 @@
# Generated by Django 4.0.4 on 2022-05-19 14:02
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Transaction',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=256)),
('description', models.TextField()),
('value', models.DecimalField(decimal_places=2, max_digits=12)),
('date', models.DateField()),
],
),
migrations.CreateModel(
name='Invoice',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=256)),
('file', models.FileField(upload_to='invoices/')),
('transaction', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.transaction')),
],
),
]

View file

17
nummi/main/models.py Normal file
View file

@ -0,0 +1,17 @@
import uuid
from django.db import models
class Transaction(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=256)
description = models.TextField()
value = models.DecimalField(max_digits=12, decimal_places=2)
date = models.DateField()
class Invoice(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=256)
file = models.FileField(upload_to="invoices/")
transaction = models.ForeignKey(Transaction, on_delete=models.CASCADE)

3
nummi/main/tests.py Normal file
View file

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

5
nummi/main/urls.py Normal file
View file

@ -0,0 +1,5 @@
from django.urls import path
from . import views
urlpatterns = [path("", views.index, name="index")]

6
nummi/main/views.py Normal file
View file

@ -0,0 +1,6 @@
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello world!")