mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 14:59:36 +02:00
Migrate to visits
This commit is contained in:
parent
6dec37d3b9
commit
0911826501
14 changed files with 110 additions and 194 deletions
|
@ -6,19 +6,9 @@ from worldtravel.models import Country, Region, VisitedRegion
|
||||||
|
|
||||||
|
|
||||||
class AdventureAdmin(admin.ModelAdmin):
|
class AdventureAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'type', 'user_id', 'is_public', 'image_display')
|
list_display = ('name', 'type', 'user_id', 'is_public')
|
||||||
list_filter = ('type', 'user_id', 'is_public')
|
list_filter = ('type', 'user_id', 'is_public')
|
||||||
|
|
||||||
def image_display(self, obj):
|
|
||||||
if obj.image:
|
|
||||||
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
|
||||||
public_url = public_url.replace("'", "")
|
|
||||||
return mark_safe(f'<img src="{public_url}/media/{obj.image.name}" width="100px" height="100px"')
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
image_display.short_description = 'Image Preview'
|
|
||||||
|
|
||||||
|
|
||||||
class CountryAdmin(admin.ModelAdmin):
|
class CountryAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'country_code', 'number_of_regions')
|
list_display = ('name', 'country_code', 'number_of_regions')
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-15 23:20
|
|
||||||
|
|
||||||
import django_resized.forms
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', 'migrate_images'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='image',
|
|
||||||
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-11 13:37
|
# Generated by Django 5.0.8 on 2024-09-22 15:12
|
||||||
|
|
||||||
import django.contrib.postgres.fields
|
import django.contrib.postgres.fields
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -17,6 +17,37 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Adventure',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('type', models.CharField(choices=[('general', 'General 🌍'), ('Outdoor', 'Outdoor 🏞️'), ('lodging', 'Lodging 🛌'), ('dining', 'Dining 🍽️'), ('activity', 'Activity 🏄'), ('attraction', 'Attraction 🎢'), ('shopping', 'Shopping 🛍️'), ('nightlife', 'Nightlife 🌃'), ('event', 'Event 🎉'), ('transportation', 'Transportation 🚗'), ('culture', 'Culture 🎭'), ('water_sports', 'Water Sports 🚤'), ('hiking', 'Hiking 🥾'), ('wildlife', 'Wildlife 🦒'), ('historical_sites', 'Historical Sites 🏛️'), ('music_concerts', 'Music & Concerts 🎶'), ('fitness', 'Fitness 🏋️'), ('art_museums', 'Art & Museums 🎨'), ('festivals', 'Festivals 🎪'), ('spiritual_journeys', 'Spiritual Journeys 🧘\u200d♀️'), ('volunteer_work', 'Volunteer Work 🤝'), ('other', 'Other')], max_length=100)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('activity_types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
|
('link', models.URLField(blank=True, max_length=2083, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('image', django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
||||||
|
('date', models.DateField(blank=True, null=True)),
|
||||||
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='AdventureImage',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('image', django_resized.forms.ResizedImageField(crop=None, force_format='WEBP', keep_meta=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
||||||
|
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='adventures.adventure')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Checklist',
|
name='Checklist',
|
||||||
fields=[
|
fields=[
|
||||||
|
@ -53,6 +84,7 @@ class Migration(migrations.Migration):
|
||||||
('end_date', models.DateField(blank=True, null=True)),
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
('updated_at', models.DateTimeField(auto_now=True)),
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
('is_archived', models.BooleanField(default=False)),
|
('is_archived', models.BooleanField(default=False)),
|
||||||
|
('shared_with', models.ManyToManyField(blank=True, related_name='shared_with', to=settings.AUTH_USER_MODEL)),
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -61,27 +93,10 @@ class Migration(migrations.Migration):
|
||||||
name='collection',
|
name='collection',
|
||||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.AddField(
|
||||||
name='Adventure',
|
model_name='adventure',
|
||||||
fields=[
|
name='collection',
|
||||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
||||||
('type', models.CharField(choices=[('visited', 'Visited'), ('planned', 'Planned'), ('lodging', 'Lodging'), ('dining', 'Dining')], max_length=100)),
|
|
||||||
('name', models.CharField(max_length=200)),
|
|
||||||
('location', models.CharField(blank=True, max_length=200, null=True)),
|
|
||||||
('activity_types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)),
|
|
||||||
('description', models.TextField(blank=True, null=True)),
|
|
||||||
('rating', models.FloatField(blank=True, null=True)),
|
|
||||||
('link', models.URLField(blank=True, null=True)),
|
|
||||||
('image', django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
|
||||||
('date', models.DateField(blank=True, null=True)),
|
|
||||||
('is_public', models.BooleanField(default=False)),
|
|
||||||
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
|
||||||
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
|
||||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('updated_at', models.DateTimeField(auto_now=True)),
|
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
||||||
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Note',
|
name='Note',
|
||||||
|
@ -108,6 +123,7 @@ class Migration(migrations.Migration):
|
||||||
('rating', models.FloatField(blank=True, null=True)),
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
('link', models.URLField(blank=True, null=True)),
|
('link', models.URLField(blank=True, null=True)),
|
||||||
('date', models.DateTimeField(blank=True, null=True)),
|
('date', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('end_date', models.DateTimeField(blank=True, null=True)),
|
||||||
('flight_number', models.CharField(blank=True, max_length=100, null=True)),
|
('flight_number', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
('from_location', models.CharField(blank=True, max_length=200, null=True)),
|
('from_location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
('to_location', models.CharField(blank=True, max_length=200, null=True)),
|
('to_location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
@ -117,5 +133,5 @@ class Migration(migrations.Migration):
|
||||||
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-15 23:17
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
import django_resized.forms
|
|
||||||
import uuid
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0001_initial'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='AdventureImage',
|
|
||||||
fields=[
|
|
||||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
|
||||||
('image', django_resized.forms.ResizedImageField(crop=None, force_format='WEBP', keep_meta=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
|
||||||
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adventures.adventure')),
|
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-15 23:31
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0001_adventure_image'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='adventureimage',
|
|
||||||
name='adventure',
|
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='adventures.adventure'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-22 04:02
|
# Generated by Django 5.0.8 on 2024-09-22 15:32
|
||||||
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import uuid
|
import uuid
|
||||||
|
@ -8,24 +8,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', '0006_alter_adventure_link'),
|
('adventures', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='date',
|
|
||||||
),
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='end_date',
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Visit',
|
name='Visit',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
('start_date', models.DateField()),
|
('start_date', models.DateField(blank=True, null=True)),
|
||||||
('end_date', models.DateField()),
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
('notes', models.TextField(blank=True, null=True)),
|
('notes', models.TextField(blank=True, null=True)),
|
||||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
('updated_at', models.DateTimeField(auto_now=True)),
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-18 16:16
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0002_alter_adventureimage_adventure'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='end_date',
|
|
||||||
field=models.DateField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-22 15:14
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', 'migrate_visits_and_categories'),
|
||||||
|
('adventures', 'migrate_images'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='date',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='end_date',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='image',
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-08-19 20:04
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0003_adventure_end_date'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='transportation',
|
|
||||||
name='end_date',
|
|
||||||
field=models.DateTimeField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-02 13:21
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0004_transportation_end_date'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='collection',
|
|
||||||
name='shared_with',
|
|
||||||
field=models.ManyToManyField(blank=True, related_name='shared_with', to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-17 14:18
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0005_collection_shared_with'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='link',
|
|
||||||
field=models.URLField(blank=True, max_length=2083, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -17,13 +17,8 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', '0001_initial'),
|
('adventures', '0001_initial'),
|
||||||
('adventures', '0002_adventureimage'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunPython(move_images_to_new_model),
|
migrations.RunPython(move_images_to_new_model),
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='Adventure',
|
|
||||||
name='image',
|
|
||||||
),
|
|
||||||
]
|
]
|
|
@ -0,0 +1,31 @@
|
||||||
|
from django.db import migrations
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
def move_images_to_new_model(apps, schema_editor):
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
Visit = apps.get_model('adventures', 'Visit')
|
||||||
|
|
||||||
|
for adventure in Adventure.objects.all():
|
||||||
|
# if the type is visited and there is no date, set note to 'No date provided.'
|
||||||
|
note = 'No date provided.' if adventure.type == 'visited' and not adventure.date else ''
|
||||||
|
if adventure.date or adventure.type == 'visited':
|
||||||
|
Visit.objects.create(
|
||||||
|
adventure=adventure,
|
||||||
|
start_date=adventure.date,
|
||||||
|
end_date=adventure.end_date,
|
||||||
|
notes=note,
|
||||||
|
)
|
||||||
|
if adventure.type == 'visited' or adventure.type == 'planned':
|
||||||
|
adventure.type = 'general'
|
||||||
|
adventure.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0002_visit')
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(move_images_to_new_model),
|
||||||
|
]
|
|
@ -50,8 +50,8 @@ User = get_user_model()
|
||||||
class Visit(models.Model):
|
class Visit(models.Model):
|
||||||
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
adventure = models.ForeignKey('Adventure', on_delete=models.CASCADE, related_name='visits')
|
adventure = models.ForeignKey('Adventure', on_delete=models.CASCADE, related_name='visits')
|
||||||
start_date = models.DateField()
|
start_date = models.DateField(null=True, blank=True)
|
||||||
end_date = models.DateField()
|
end_date = models.DateField(null=True, blank=True)
|
||||||
notes = models.TextField(blank=True, null=True)
|
notes = models.TextField(blank=True, null=True)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
@ -67,7 +67,7 @@ class Adventure(models.Model):
|
||||||
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
user_id = models.ForeignKey(
|
user_id = models.ForeignKey(
|
||||||
User, on_delete=models.CASCADE, default=default_user_id)
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
type = models.CharField(max_length=100, choices=ADVENTURE_TYPES)
|
type = models.CharField(max_length=100, choices=ADVENTURE_TYPES, default='general')
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
location = models.CharField(max_length=200, blank=True, null=True)
|
location = models.CharField(max_length=200, blank=True, null=True)
|
||||||
activity_types = ArrayField(models.CharField(
|
activity_types = ArrayField(models.CharField(
|
||||||
|
@ -75,7 +75,6 @@ class Adventure(models.Model):
|
||||||
description = models.TextField(blank=True, null=True)
|
description = models.TextField(blank=True, null=True)
|
||||||
rating = models.FloatField(blank=True, null=True)
|
rating = models.FloatField(blank=True, null=True)
|
||||||
link = models.URLField(blank=True, null=True, max_length=2083)
|
link = models.URLField(blank=True, null=True, max_length=2083)
|
||||||
image = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='images/')
|
|
||||||
is_public = models.BooleanField(default=False)
|
is_public = models.BooleanField(default=False)
|
||||||
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
@ -83,6 +82,12 @@ class Adventure(models.Model):
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
# DEPRECATED FIELDS - TO BE REMOVED IN FUTURE VERSIONS
|
||||||
|
# Migrations performed in this version will remove these fields
|
||||||
|
# image = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='images/')
|
||||||
|
# date = models.DateField(blank=True, null=True)
|
||||||
|
# end_date = models.DateField(blank=True, null=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
||||||
if self.collection:
|
if self.collection:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue