Compare commits

2 Commits

Author SHA1 Message Date
dd8eea06e6 worked on model file 2024-09-02 01:13:39 +02:00
f531f92b48 added django app dbmodels 2024-09-02 01:08:48 +02:00
7 changed files with 83 additions and 0 deletions

0
products/__init__.py Normal file
View File

3
products/admin.py Normal file
View File

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

6
products/apps.py Normal file
View File

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

View File

68
products/models.py Normal file
View File

@ -0,0 +1,68 @@
from django.db import models
# Create your models here.
class Chapter(models.Model): # chapter first hirachical element Osterosynthese
id = models.IntegerField(primary_key=True) #SetPrimarykey
title = models.CharField(max_length=100) # or name
icon = models.ImageField(default='fallback.png', blank=True)
def __str__(self):
return self.title
class Section(models.Model):# second hirachical element # Oberarm
id = models.IntegerField(primary_key=True) #SetPrimarykey
title = models.CharField(max_length=100) # or name
icon = models.ImageField(default='fallback.png', blank=True)
def __str__(self):
return self.title
class Subsection(models.Model):#Proximaler Oberarm
id = models.IntegerField(primary_key=True) #SetPrimarykey
title = models.CharField(max_length=100) # or name
icon = models.ImageField(default='fallback.png', blank=True)
def __str__(self):
return self.title
class ProductType(models.Model): #Platte
id = models.IntegerField(primary_key=True) #SetPrimarykey
title = models.CharField(max_length=100) # or name
icon = models.ImageField(default='fallback.png', blank=True)
class Manufacturer(models.Model):
id = models.IntegerField(primary_key=True) #SetPrimarykey
name = models.CharField(max_length=100) # or name
icon = models.ImageField(default='fallback.png', blank=True)
class ContactPerson
class Product(models.Model):
id = models.IntegerField(primary_key=True)
ProductType = models.ManyToOneRel(ProductType)
chaper = models.ManyToManyField(Chapter)
section = models.ManyToManyField(Section)
subsection = models.ManyToManyField(Subsection)
title = models.CharField(max_length=75)
name = models.CharField(max_length=75)
description = models.TextField()
slug = models.SlugField()
date = models.DateTimeField(auto_now_add=True)
banner = models.ImageField(default='fallback.png', blank=True)
manufacturer = models.ForeignKey(Manufacturer, on_delete=models.CASCADE, default=None) #Kritisch wenn conus medical products are linked to User.objects.get(username='root')company and compony is deleted all products are deleted.
def __str__(self):
return self.title
"""
def user_directory_path(instance, filename):
return "user_{0}/{1}".format(instance.user.id, filename)
upload_to_pattern = FilePattern(filename_pattern='PDFuploads/{app_label:.25}/{model_name:.30}/{uuid:base32}{ext}')
class ConusFilePDF(models.Model):
fileName = models.CharField(max_length=32)
#file = models.FileField(upload_to="PDFuploads/")
file = models.FileField(upload_to=upload_to_pattern)
"""

3
products/tests.py Normal file
View File

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

3
products/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.