mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-02 19:55:18 +02:00
collection days
This commit is contained in:
parent
055290ce3f
commit
c94a4379c7
8 changed files with 101 additions and 5 deletions
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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):
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue