1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

collection days

This commit is contained in:
Sean Morley 2024-07-27 14:26:15 -04:00
parent 055290ce3f
commit c94a4379c7
8 changed files with 101 additions and 5 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 5.0.7 on 2024-07-27 18:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adventures', '0011_adventure_updated_at'),
]
operations = [
migrations.AddField(
model_name='collection',
name='end_date',
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
model_name='collection',
name='start_date',
field=models.DateField(blank=True, null=True),
),
]

View file

@ -56,6 +56,8 @@ class Collection(models.Model):
description = models.TextField(blank=True, null=True)
is_public = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
start_date = models.DateField(blank=True, null=True)
end_date = models.DateField(blank=True, null=True)
# if connected adventures are private and collection is public, raise an error
def clean(self):

View file

@ -29,7 +29,7 @@ class CollectionSerializer(serializers.ModelSerializer):
class Meta:
model = Collection
# fields are all plus the adventures field
fields = ['id', 'description', 'user_id', 'name', 'is_public', 'adventures']
fields = ['id', 'description', 'user_id', 'name', 'is_public', 'adventures', 'created_at', 'start_date', 'end_date']