Basic table inline edit functionality
This commit is contained in:
60
project/main/migrations/0003_person.py
Normal file
60
project/main/migrations/0003_person.py
Normal file
@ -0,0 +1,60 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def create_persons_data(apps, schema_editor):
|
||||
Person = apps.get_model("main", "Person")
|
||||
|
||||
bulk = [
|
||||
Person(
|
||||
name="Pero",
|
||||
address="Perina ulica 15",
|
||||
city="Zagreb",
|
||||
),
|
||||
Person(
|
||||
name="Mirko",
|
||||
address="Mirkova ulica 17",
|
||||
city="Zagreb",
|
||||
),
|
||||
Person(
|
||||
name="Šime",
|
||||
address="Šimina ulica 19",
|
||||
city="Split",
|
||||
),
|
||||
Person(
|
||||
name="Furio",
|
||||
address="Furiozna ulica 21",
|
||||
city="Pula",
|
||||
),
|
||||
]
|
||||
|
||||
Person.objects.bulk_create(bulk)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("main", "0002_example_data"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Person",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(max_length=100)),
|
||||
("address", models.CharField(max_length=100)),
|
||||
("city", models.CharField(max_length=100)),
|
||||
],
|
||||
options={
|
||||
"db_table": "persons",
|
||||
},
|
||||
),
|
||||
migrations.RunPython(create_persons_data),
|
||||
]
|
||||
Reference in New Issue
Block a user