reset migrations again (not doing participants for now, leads to truple with the manytomany field with the same name)

This commit is contained in:
Gesche 2021-04-20 00:01:36 +02:00
parent 0a8176eaee
commit f2bb16aeb2
3 changed files with 61 additions and 5 deletions

View File

@ -0,0 +1,56 @@
# Generated by Django 3.1.7 on 2021-04-19 22:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Story',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=256, null=True)),
('created', models.DateTimeField(auto_now_add=True)),
('finished', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='StoryRound',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=256)),
('created', models.DateTimeField(auto_now_add=True)),
('number_of_rounds', models.IntegerField()),
('participants', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='StoryPart',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(blank=True, null=True)),
('part_of', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='writingtogether.story')),
('previous_part', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='writingtogether.storypart')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='story',
name='part_of_round',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='writingtogether.storyround'),
),
migrations.AddField(
model_name='story',
name='started_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]

View File

@ -20,10 +20,10 @@ class StoryRound(models.Model):
pass pass
class Participant(models.Model): #class Participant(models.Model):
user = models.ForeignKey(User, on_delete=CASCADE) # user = models.ForeignKey(User, on_delete=CASCADE)
story_round = models.ForeignKey(StoryRound, on_delete=CASCADE) # story_round = models.ForeignKey(StoryRound, on_delete=CASCADE)
order_by = models.IntegerField() # order_by = models.IntegerField()
class Story(models.Model): class Story(models.Model):

View File

@ -7,7 +7,7 @@ from django.urls import reverse_lazy, reverse
from django.views import generic from django.views import generic
from django.views.generic import CreateView, UpdateView, RedirectView from django.views.generic import CreateView, UpdateView, RedirectView
from writingtogether.models import Story, StoryPart, StoryRound, Participant from writingtogether.models import Story, StoryPart, StoryRound
class IndexView(generic.ListView): class IndexView(generic.ListView):