django-web-galleries/django_web_galleries/web_galleries/migrations/0001_initial.py

56 lines
3.1 KiB
Python

# Generated by Django 4.1.4 on 2022-12-18 08:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Gallery',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100, null=True, verbose_name='Optional title for this gallery')),
('private', models.BooleanField(blank=True, default=False, verbose_name='Wether the gallery is vsibile publicly or to certain users only')),
('access_code', models.CharField(max_length=32, null=True, verbose_name='Code to access private galleries')),
],
),
migrations.CreateModel(
name='Visitor',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('session_id', models.CharField(max_length=50, verbose_name='A cookie set by this application to identify a visitor by session')),
('name', models.CharField(default=None, max_length=50, null=True, unique=True, verbose_name='Human readable, self assigned name of the visitor')),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(null=True, verbose_name='An optional description of the Image')),
('image_file', models.ImageField(upload_to='web_galleries/uploads/', verbose_name='File of the image')),
('private', models.BooleanField(blank=True, default=False, verbose_name='Wether this image is visible publicly or to certain users only')),
('access_code', models.CharField(max_length=32, null=True, verbose_name='Code to access private images')),
('uploaded_when', models.DateTimeField(auto_now_add=True, verbose_name='When this picture was uploaded')),
('galleries', models.ManyToManyField(related_name='images', to='web_galleries.gallery', verbose_name='What galleries this image is in')),
('uploaded_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='uploaded_images', to='web_galleries.visitor', verbose_name='Which visitor uploaded this picture')),
],
),
migrations.AddField(
model_name='gallery',
name='created_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_galleries', to='web_galleries.visitor', verbose_name='Visitor who created the gallery'),
),
migrations.AddField(
model_name='gallery',
name='visitors',
field=models.ManyToManyField(related_name='linked_galleries', to='web_galleries.visitor', verbose_name='Visitors that a part of this gallery'),
),
]