mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 15:29:36 +02:00
Fix migrations
This commit is contained in:
parent
0911826501
commit
0fdc119028
14 changed files with 226 additions and 72 deletions
|
@ -1,18 +1,20 @@
|
||||||
import os
|
import os
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.html import mark_safe
|
from django.utils.html import mark_safe
|
||||||
from .models import Adventure, Checklist, ChecklistItem, Collection, Transportation, Note, AdventureImage
|
from .models import Adventure, Checklist, ChecklistItem, Collection, Transportation, Note, AdventureImage, Visit
|
||||||
from worldtravel.models import Country, Region, VisitedRegion
|
from worldtravel.models import Country, Region, VisitedRegion
|
||||||
|
|
||||||
|
|
||||||
class AdventureAdmin(admin.ModelAdmin):
|
class AdventureAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'type', 'user_id', 'is_public')
|
list_display = ('name', 'type', 'user_id', 'is_public')
|
||||||
list_filter = ('type', 'user_id', 'is_public')
|
list_filter = ('type', 'user_id', 'is_public')
|
||||||
|
search_fields = ('name',)
|
||||||
|
|
||||||
|
|
||||||
class CountryAdmin(admin.ModelAdmin):
|
class CountryAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'country_code', 'number_of_regions')
|
list_display = ('name', 'country_code', 'number_of_regions')
|
||||||
list_filter = ('subregion',)
|
list_filter = ('subregion',)
|
||||||
|
search_fields = ('name', 'country_code')
|
||||||
|
|
||||||
def number_of_regions(self, obj):
|
def number_of_regions(self, obj):
|
||||||
return Region.objects.filter(country=obj).count()
|
return Region.objects.filter(country=obj).count()
|
||||||
|
@ -23,6 +25,7 @@ class CountryAdmin(admin.ModelAdmin):
|
||||||
class RegionAdmin(admin.ModelAdmin):
|
class RegionAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'country', 'number_of_visits')
|
list_display = ('name', 'country', 'number_of_visits')
|
||||||
list_filter = ('country',)
|
list_filter = ('country',)
|
||||||
|
search_fields = ('name', 'country__name')
|
||||||
# list_filter = ('country', 'number_of_visits')
|
# list_filter = ('country', 'number_of_visits')
|
||||||
|
|
||||||
def number_of_visits(self, obj):
|
def number_of_visits(self, obj):
|
||||||
|
@ -38,6 +41,7 @@ class CustomUserAdmin(UserAdmin):
|
||||||
model = CustomUser
|
model = CustomUser
|
||||||
list_display = ['username', 'email', 'is_staff', 'is_active', 'image_display']
|
list_display = ['username', 'email', 'is_staff', 'is_active', 'image_display']
|
||||||
readonly_fields = ('uuid',)
|
readonly_fields = ('uuid',)
|
||||||
|
search_fields = ('username', 'email')
|
||||||
fieldsets = UserAdmin.fieldsets + (
|
fieldsets = UserAdmin.fieldsets + (
|
||||||
(None, {'fields': ('profile_pic', 'uuid', 'public_profile')}),
|
(None, {'fields': ('profile_pic', 'uuid', 'public_profile')}),
|
||||||
)
|
)
|
||||||
|
@ -52,6 +56,21 @@ class CustomUserAdmin(UserAdmin):
|
||||||
class AdventureImageAdmin(admin.ModelAdmin):
|
class AdventureImageAdmin(admin.ModelAdmin):
|
||||||
list_display = ('user_id', 'image_display')
|
list_display = ('user_id', 'image_display')
|
||||||
|
|
||||||
|
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.profile_pic.name}" width="100px" height="100px"')
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
class VisitAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('adventure', 'start_date', 'end_date', 'notes')
|
||||||
|
list_filter = ('start_date', 'end_date')
|
||||||
|
search_fields = ('notes',)
|
||||||
|
|
||||||
|
|
||||||
def image_display(self, obj):
|
def image_display(self, obj):
|
||||||
if obj.image: # Ensure this field matches your model's image field
|
if obj.image: # Ensure this field matches your model's image field
|
||||||
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
||||||
|
@ -77,6 +96,7 @@ admin.site.register(CustomUser, CustomUserAdmin)
|
||||||
|
|
||||||
admin.site.register(Adventure, AdventureAdmin)
|
admin.site.register(Adventure, AdventureAdmin)
|
||||||
admin.site.register(Collection, CollectionAdmin)
|
admin.site.register(Collection, CollectionAdmin)
|
||||||
|
admin.site.register(Visit, VisitAdmin)
|
||||||
admin.site.register(Country, CountryAdmin)
|
admin.site.register(Country, CountryAdmin)
|
||||||
admin.site.register(Region, RegionAdmin)
|
admin.site.register(Region, RegionAdmin)
|
||||||
admin.site.register(VisitedRegion)
|
admin.site.register(VisitedRegion)
|
||||||
|
|
19
backend/server/adventures/migrations/0001_adventure_image.py
Normal file
19
backend/server/adventures/migrations/0001_adventure_image.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# 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-09-22 15:12
|
# Generated by Django 5.0.8 on 2024-08-11 13:37
|
||||||
|
|
||||||
import django.contrib.postgres.fields
|
import django.contrib.postgres.fields
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -17,37 +17,6 @@ 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=[
|
||||||
|
@ -84,7 +53,6 @@ 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)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -93,10 +61,27 @@ 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.AddField(
|
migrations.CreateModel(
|
||||||
model_name='adventure',
|
name='Adventure',
|
||||||
name='collection',
|
fields=[
|
||||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('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',
|
||||||
|
@ -123,7 +108,6 @@ 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)),
|
||||||
|
@ -133,5 +117,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)),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
|
|
27
backend/server/adventures/migrations/0002_adventureimage.py
Normal file
27
backend/server/adventures/migrations/0002_adventureimage.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# 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)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# 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,27 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-22 15:32
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
import uuid
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Visit',
|
|
||||||
fields=[
|
|
||||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
|
||||||
('start_date', models.DateField(blank=True, null=True)),
|
|
||||||
('end_date', models.DateField(blank=True, null=True)),
|
|
||||||
('notes', models.TextField(blank=True, null=True)),
|
|
||||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('updated_at', models.DateTimeField(auto_now=True)),
|
|
||||||
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='visits', to='adventures.adventure')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# 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,18 @@
|
||||||
|
# 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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,20 @@
|
||||||
|
# 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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# 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),
|
||||||
|
),
|
||||||
|
]
|
32
backend/server/adventures/migrations/0007_visit_model.py
Normal file
32
backend/server/adventures/migrations/0007_visit_model.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-23 18:06
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0006_alter_adventure_link'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='type',
|
||||||
|
field=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')], default='general', max_length=100),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Visit',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('start_date', models.DateField(blank=True, null=True)),
|
||||||
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
|
('notes', models.TextField(blank=True, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='visits', to='adventures.adventure')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,13 +1,14 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-22 15:14
|
# Generated by Django 5.0.8 on 2024-09-23 18:06
|
||||||
|
|
||||||
from django.db import migrations
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', 'migrate_visits_and_categories'),
|
('adventures', 'migrate_visits_categories'),
|
||||||
('adventures', 'migrate_images'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -17,8 +17,13 @@ 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',
|
||||||
|
),
|
||||||
]
|
]
|
|
@ -23,7 +23,7 @@ def move_images_to_new_model(apps, schema_editor):
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', '0002_visit')
|
('adventures', '0007_visit_model'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
Loading…
Add table
Add a link
Reference in a new issue