Add generated cats app
- generated app by running python3 manage.py startapp cats - add cats to INSTALLED_APPS in django_cats/settings.py - generated model by running python3 manage.py inspectdb > cats/models.py - generated migration by running python3 manage.py makemigrations -n "models_created_by_inspectdb" cats
This commit is contained in:
parent
d2ac11f238
commit
77464ecee4
9 changed files with 490 additions and 0 deletions
0
cats/__init__.py
Normal file
0
cats/__init__.py
Normal file
3
cats/admin.py
Normal file
3
cats/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
cats/apps.py
Normal file
6
cats/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class CatsConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
|
name = "cats"
|
292
cats/migrations/0001_models_created_by_inspectdb.py
Normal file
292
cats/migrations/0001_models_created_by_inspectdb.py
Normal file
|
@ -0,0 +1,292 @@
|
||||||
|
# Generated by Django 4.2.16 on 2024-09-18 16:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Answer",
|
||||||
|
fields=[
|
||||||
|
("a_id", models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
("q_id", models.IntegerField()),
|
||||||
|
("answer", models.TextField()),
|
||||||
|
("correct", models.IntegerField()),
|
||||||
|
("ref_a_id", models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "answers",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="IncorrectAnswer",
|
||||||
|
fields=[
|
||||||
|
("lp_id", models.IntegerField(primary_key=True, serialize=False)),
|
||||||
|
("q_id", models.IntegerField()),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "answers_incorrect",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="LearnProgress",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"lp_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Schlüssel", primary_key=True, serialize=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("user_id", models.CharField(max_length=15)),
|
||||||
|
("root", models.CharField(max_length=45)),
|
||||||
|
("date", models.DateTimeField(db_comment="Uhrzeit und Datum")),
|
||||||
|
("t_id", models.IntegerField(db_comment="Themen ID")),
|
||||||
|
("number", models.IntegerField(db_comment="Anzahl der Fragen")),
|
||||||
|
("correct", models.IntegerField(db_comment="Richtige Fragen")),
|
||||||
|
(
|
||||||
|
"wrong",
|
||||||
|
models.IntegerField(db_comment="Anzahl der falschen Antworten"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"percentage",
|
||||||
|
models.DecimalField(
|
||||||
|
blank=True, decimal_places=0, max_digits=5, null=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("uploaded", models.IntegerField(blank=True, null=True)),
|
||||||
|
("passed", models.IntegerField()),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "learnprogress",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Question",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"q_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Primärschlüssel", primary_key=True, serialize=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("qt_id", models.IntegerField(db_comment="Fragetyp")),
|
||||||
|
("t_id", models.IntegerField(db_comment="Topic_id")),
|
||||||
|
("question", models.TextField(db_comment="Frage")),
|
||||||
|
("active", models.CharField(max_length=1)),
|
||||||
|
("description", models.CharField(max_length=1)),
|
||||||
|
("ref_q_id", models.IntegerField(blank=True, null=True)),
|
||||||
|
("translationstatus", models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "questions",
|
||||||
|
"db_table_comment": "Fragen",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="QuestionDescription",
|
||||||
|
fields=[
|
||||||
|
("q_id", models.IntegerField(primary_key=True, serialize=False)),
|
||||||
|
("description", models.TextField()),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "question_description",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="QuestionType",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"qt_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Fragetypenschlüssel",
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"de",
|
||||||
|
models.CharField(
|
||||||
|
db_column="DE", db_comment="Fragetyp", max_length=25
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("en", models.CharField(db_column="EN", max_length=25)),
|
||||||
|
(
|
||||||
|
"fr",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, db_column="FR", max_length=25, null=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "questiontype",
|
||||||
|
"db_table_comment": "Fragetypen",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="QuestionTypeV2",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"qt_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Fragetypenschlssel",
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("lang", models.CharField(db_comment="Sprache", max_length=5)),
|
||||||
|
("qt_desc", models.CharField(db_comment="Fragetyp", max_length=25)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "questiontype_v2",
|
||||||
|
"db_table_comment": "Fragetypen",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="SchemaVersion",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("version", models.IntegerField(unique=True)),
|
||||||
|
("when", models.DateTimeField()),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "schema_version",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Statistics",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"stat_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Primärschlüssel",
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("q_id", models.IntegerField(db_comment="Frage Id")),
|
||||||
|
("count", models.IntegerField(db_comment="Zählen von Antworten")),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "statistics",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Temp",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("uid", models.CharField(blank=True, max_length=10, null=True)),
|
||||||
|
("number", models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "temp",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Topic",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"t_id",
|
||||||
|
models.AutoField(
|
||||||
|
db_comment="Primärschlüssel", primary_key=True, serialize=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"topic",
|
||||||
|
models.CharField(db_comment="Thema", max_length=50, unique=True),
|
||||||
|
),
|
||||||
|
("active", models.IntegerField()),
|
||||||
|
("numofqu", models.IntegerField(db_column="numOfQu")),
|
||||||
|
("percentage", models.IntegerField()),
|
||||||
|
("lang", models.CharField(blank=True, max_length=42, null=True)),
|
||||||
|
("type_id", models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "topics",
|
||||||
|
"db_table_comment": "Themen",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="TopicType",
|
||||||
|
fields=[
|
||||||
|
("type_id", models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
("text", models.CharField(max_length=255)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "topic_type",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="User",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"user_id",
|
||||||
|
models.CharField(max_length=10, primary_key=True, serialize=False),
|
||||||
|
),
|
||||||
|
("cn_name", models.CharField(db_column="CN_name", max_length=100)),
|
||||||
|
("lang", models.CharField(max_length=2)),
|
||||||
|
("admin", models.CharField(max_length=1)),
|
||||||
|
("email", models.CharField(max_length=100)),
|
||||||
|
("sendcert", models.CharField(db_column="sendCert", max_length=13)),
|
||||||
|
("root", models.CharField(max_length=45)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "user",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="UserAddress",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"user_id",
|
||||||
|
models.CharField(max_length=10, primary_key=True, serialize=False),
|
||||||
|
),
|
||||||
|
("root", models.CharField(max_length=45)),
|
||||||
|
("firstname", models.CharField(max_length=25)),
|
||||||
|
("lastname", models.CharField(max_length=25)),
|
||||||
|
("street", models.CharField(max_length=50)),
|
||||||
|
("housenumber", models.CharField(max_length=5)),
|
||||||
|
("zipcode", models.CharField(max_length=10)),
|
||||||
|
("city", models.CharField(max_length=30)),
|
||||||
|
("state", models.CharField(max_length=50)),
|
||||||
|
("country", models.CharField(max_length=50)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"db_table": "user_address",
|
||||||
|
"managed": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
0
cats/migrations/__init__.py
Normal file
0
cats/migrations/__init__.py
Normal file
182
cats/models.py
Normal file
182
cats/models.py
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
# This is an auto-generated Django model module.
|
||||||
|
# You'll have to do the following manually to clean this up:
|
||||||
|
# * Rearrange models' order
|
||||||
|
# * Make sure each model has one field with primary_key=True
|
||||||
|
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
|
||||||
|
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
|
||||||
|
# Feel free to rename the models, but don't rename db_table values or field names.
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class Answer(models.Model):
|
||||||
|
a_id = models.AutoField(primary_key=True)
|
||||||
|
q_id = models.IntegerField()
|
||||||
|
answer = models.TextField()
|
||||||
|
correct = models.IntegerField()
|
||||||
|
ref_a_id = models.IntegerField(blank=True, null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'answers'
|
||||||
|
|
||||||
|
|
||||||
|
class IncorrectAnswer(models.Model):
|
||||||
|
lp_id = models.IntegerField(primary_key=True) # The composite primary key (lp_id, q_id) found, that is not supported. The first column is selected.
|
||||||
|
q_id = models.IntegerField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'answers_incorrect'
|
||||||
|
unique_together = (('lp_id', 'q_id'),)
|
||||||
|
|
||||||
|
|
||||||
|
class LearnProgress(models.Model):
|
||||||
|
lp_id = models.AutoField(primary_key=True, db_comment='Schlüssel')
|
||||||
|
user_id = models.CharField(max_length=15)
|
||||||
|
root = models.CharField(max_length=45)
|
||||||
|
date = models.DateTimeField(db_comment='Uhrzeit und Datum')
|
||||||
|
t_id = models.IntegerField(db_comment='Themen ID')
|
||||||
|
number = models.IntegerField(db_comment='Anzahl der Fragen')
|
||||||
|
correct = models.IntegerField(db_comment='Richtige Fragen')
|
||||||
|
wrong = models.IntegerField(db_comment='Anzahl der falschen Antworten')
|
||||||
|
percentage = models.DecimalField(max_digits=5, decimal_places=0, blank=True, null=True)
|
||||||
|
uploaded = models.IntegerField(blank=True, null=True)
|
||||||
|
passed = models.IntegerField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'learnprogress'
|
||||||
|
|
||||||
|
|
||||||
|
class QuestionDescription(models.Model):
|
||||||
|
q_id = models.IntegerField(primary_key=True)
|
||||||
|
description = models.TextField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'question_description'
|
||||||
|
|
||||||
|
|
||||||
|
class Question(models.Model):
|
||||||
|
q_id = models.AutoField(primary_key=True, db_comment='Primärschlüssel')
|
||||||
|
qt_id = models.IntegerField(db_comment='Fragetyp')
|
||||||
|
t_id = models.IntegerField(db_comment='Topic_id')
|
||||||
|
question = models.TextField(db_comment='Frage')
|
||||||
|
active = models.CharField(max_length=1)
|
||||||
|
description = models.CharField(max_length=1)
|
||||||
|
ref_q_id = models.IntegerField(blank=True, null=True)
|
||||||
|
translationstatus = models.IntegerField(blank=True, null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'questions'
|
||||||
|
db_table_comment = 'Fragen'
|
||||||
|
|
||||||
|
|
||||||
|
class QuestionType(models.Model):
|
||||||
|
qt_id = models.AutoField(primary_key=True, db_comment='Fragetypenschlüssel')
|
||||||
|
de = models.CharField(db_column='DE', max_length=25, db_comment='Fragetyp') # Field name made lowercase.
|
||||||
|
en = models.CharField(db_column='EN', max_length=25) # Field name made lowercase.
|
||||||
|
fr = models.CharField(db_column='FR', max_length=25, blank=True, null=True) # Field name made lowercase.
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'questiontype'
|
||||||
|
db_table_comment = 'Fragetypen'
|
||||||
|
|
||||||
|
|
||||||
|
class QuestionTypeV2(models.Model):
|
||||||
|
qt_id = models.AutoField(primary_key=True, db_comment='Fragetypenschlssel') # The composite primary key (qt_id, lang) found, that is not supported. The first column is selected.
|
||||||
|
lang = models.CharField(max_length=5, db_comment='Sprache')
|
||||||
|
qt_desc = models.CharField(max_length=25, db_comment='Fragetyp')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'questiontype_v2'
|
||||||
|
unique_together = (('qt_id', 'lang'),)
|
||||||
|
db_table_comment = 'Fragetypen'
|
||||||
|
|
||||||
|
|
||||||
|
class SchemaVersion(models.Model):
|
||||||
|
version = models.IntegerField(unique=True)
|
||||||
|
when = models.DateTimeField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'schema_version'
|
||||||
|
|
||||||
|
|
||||||
|
class Statistics(models.Model):
|
||||||
|
stat_id = models.AutoField(primary_key=True, db_comment='Primärschlüssel')
|
||||||
|
q_id = models.IntegerField(db_comment='Frage Id')
|
||||||
|
count = models.IntegerField(db_comment='Zählen von Antworten')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'statistics'
|
||||||
|
|
||||||
|
|
||||||
|
class Temp(models.Model):
|
||||||
|
uid = models.CharField(max_length=10, blank=True, null=True)
|
||||||
|
number = models.IntegerField(blank=True, null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'temp'
|
||||||
|
|
||||||
|
|
||||||
|
class TopicType(models.Model):
|
||||||
|
type_id = models.AutoField(primary_key=True)
|
||||||
|
text = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'topic_type'
|
||||||
|
|
||||||
|
|
||||||
|
class Topic(models.Model):
|
||||||
|
t_id = models.AutoField(primary_key=True, db_comment='Primärschlüssel')
|
||||||
|
topic = models.CharField(unique=True, max_length=50, db_comment='Thema')
|
||||||
|
active = models.IntegerField()
|
||||||
|
numofqu = models.IntegerField(db_column='numOfQu') # Field name made lowercase.
|
||||||
|
percentage = models.IntegerField()
|
||||||
|
lang = models.CharField(max_length=42, blank=True, null=True)
|
||||||
|
type_id = models.IntegerField(blank=True, null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'topics'
|
||||||
|
db_table_comment = 'Themen'
|
||||||
|
|
||||||
|
|
||||||
|
class User(models.Model):
|
||||||
|
user_id = models.CharField(primary_key=True, max_length=10) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
||||||
|
cn_name = models.CharField(db_column='CN_name', max_length=100) # Field name made lowercase.
|
||||||
|
lang = models.CharField(max_length=2)
|
||||||
|
admin = models.CharField(max_length=1)
|
||||||
|
email = models.CharField(max_length=100)
|
||||||
|
sendcert = models.CharField(db_column='sendCert', max_length=13) # Field name made lowercase.
|
||||||
|
root = models.CharField(max_length=45)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'user'
|
||||||
|
unique_together = (('user_id', 'root'),)
|
||||||
|
|
||||||
|
|
||||||
|
class UserAddress(models.Model):
|
||||||
|
user_id = models.CharField(primary_key=True, max_length=10) # The composite primary key (user_id, root) found, that is not supported. The first column is selected.
|
||||||
|
root = models.CharField(max_length=45)
|
||||||
|
firstname = models.CharField(max_length=25)
|
||||||
|
lastname = models.CharField(max_length=25)
|
||||||
|
street = models.CharField(max_length=50)
|
||||||
|
housenumber = models.CharField(max_length=5)
|
||||||
|
zipcode = models.CharField(max_length=10)
|
||||||
|
city = models.CharField(max_length=30)
|
||||||
|
state = models.CharField(max_length=50)
|
||||||
|
country = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
managed = False
|
||||||
|
db_table = 'user_address'
|
||||||
|
unique_together = (('user_id', 'root'),)
|
3
cats/tests.py
Normal file
3
cats/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
cats/views.py
Normal file
3
cats/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
|
@ -44,6 +44,7 @@ INSTALLED_APPS = [
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
"django.contrib.messages",
|
"django.contrib.messages",
|
||||||
"django.contrib.staticfiles",
|
"django.contrib.staticfiles",
|
||||||
|
"cats",
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
Loading…
Reference in a new issue