[collector] create initial model and migration
This commit is contained in:
parent
8cc5d405b4
commit
67bb3e0777
3 changed files with 56 additions and 0 deletions
collector
41
collector/migrations/0001_initial.py
Normal file
41
collector/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Generated by Django 5.1.7 on 2025-03-12 21:29
|
||||
|
||||
import django_extensions.db.fields
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Teile",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.TextField(verbose_name="Name of the part")),
|
||||
(
|
||||
"modified",
|
||||
django_extensions.db.fields.ModificationDateTimeField(
|
||||
auto_now=True, verbose_name="last changed"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"indexes": [models.Index(fields=["modified"], name="modified")],
|
||||
"constraints": [
|
||||
models.UniqueConstraint(fields=("name",), name="unique_names")
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
0
collector/migrations/__init__.py
Normal file
0
collector/migrations/__init__.py
Normal file
15
collector/models.py
Normal file
15
collector/models.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from django.db import models
|
||||
from django_extensions.db.models import ModificationDateTimeField
|
||||
|
||||
|
||||
class Teile(models.Model):
|
||||
name = models.TextField("Name of the part", null=False, blank=False)
|
||||
modified = ModificationDateTimeField("last changed")
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=["name"], name="unique_names"),
|
||||
]
|
||||
indexes = [
|
||||
models.Index(fields=["modified"], name="modified"),
|
||||
]
|
Loading…
Add table
Reference in a new issue