Compare commits

...

2 Commits

7 changed files with 43 additions and 0 deletions

0
back/tmc/__init__.py Normal file
View File

4
back/tmc/admin.py Normal file
View File

@ -0,0 +1,4 @@
from django.contrib import admin
from .models import CustomField, CustomTable
admin.site.register(CustomField, CustomTable)

6
back/tmc/apps.py Normal file
View File

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

View File

28
back/tmc/models.py Normal file
View File

@ -0,0 +1,28 @@
from django.db import models
class CustomField(models.Model):
FIELD_TYPES = (
('char', 'CharField'),
('int', 'IntegerField'),
('text', 'TextField'),
('bool', 'BooleanField'),
('date', 'DateField'),
)
name = models.CharField(max_length=100)
field_type = models.CharField(max_length=10, choices=FIELD_TYPES)
required = models.BooleanField(default=False)
def __str__(self):
return self.name
class CustomTable(models.Model):
custom_table = models.ForeignKey(CustomField, on_delete = models.CASCADE)
name = models.CharField("Наименование", max_length=100)
task_info = models.TextField("Информация, которая хранится в задачах на поставку ТМЦ (взяты из трекера)")
scan = models.TextField("Скан сертификата")
comment = models.TextField("Комментарий",blank=True, null=True)
def __str__(self):
return self.name

3
back/tmc/tests.py Normal file
View File

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

2
back/tmc/views.py Normal file
View File

@ -0,0 +1,2 @@
from django.shortcuts import render