register and sign in pages

This commit is contained in:
2026-09-22 00:50:30 +05:00
parent f313867653
commit 78d04f75d1
96 changed files with 6383 additions and 109 deletions
@@ -0,0 +1,40 @@
# Generated by Django 5.2.7 on 2026-09-21 19:05
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Atoll',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
('code', models.CharField(blank=True, max_length=8)),
('is_active', models.BooleanField(default=True)),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Island',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('is_active', models.BooleanField(default=True)),
('atoll', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='islands', to='locations.atoll')),
],
options={
'ordering': ['name'],
'constraints': [models.UniqueConstraint(fields=('atoll', 'name'), name='unique_island_name_per_atoll')],
},
),
]
@@ -0,0 +1,32 @@
from django.db import migrations
from locations.seed import seed
def seed_locations(apps, schema_editor):
seed(apps.get_model("locations", "Atoll"), apps.get_model("locations", "Island"))
def unseed_locations(apps, schema_editor):
"""Only removes rows nothing references."""
Atoll = apps.get_model("locations", "Atoll")
Island = apps.get_model("locations", "Island")
from locations.seed import ATOLLS
for entry in ATOLLS:
Island.objects.filter(
atoll__name=entry["name"], name__in=entry["islands"], users__isnull=True
).delete()
Atoll.objects.filter(
name=entry["name"], islands__isnull=True, users__isnull=True
).delete()
class Migration(migrations.Migration):
dependencies = [
("locations", "0001_initial"),
# Islands/atolls are referenced by users; keep the tables in step.
("users", "0001_initial"),
]
operations = [migrations.RunPython(seed_locations, unseed_locations)]