# Generated by Django 5.1.1 on 2024-09-15 17:50 from django.db import migrations from datetime import datetime, timedelta def create_space_walks(apps, schema_editor): SpaceWalks = apps.get_model('space_walks', 'SpaceWalks') space_walks_data = [ {'astronaut': 'Chris Cassidy', 'date': '2018-11-02', 'duration': '06:36:00', 'description': 'Replaced a faulty battery on the Japanese Experiment Module Exposed Facility (JEM-EF).'}, {'astronaut': 'Anne McClain', 'date': '2019-03-29', 'duration': '06:31:00', 'description': 'Installed new batteries on the JEM-EF and replaced a faulty pump on the Kibo laboratory module.'}, {'astronaut': 'Christina Koch', 'date': '2019-05-30', 'duration': '06:30:00', 'description': 'Replaced a faulty pump on the JEM-EF and installed new batteries on the Kibo laboratory module.'}, {'astronaut': 'Luca Parmitano', 'date': '2019-10-18', 'duration': '06:50:00', 'description': 'Installed new batteries on the JEM-EF and replaced a faulty pump on the Kibo laboratory module.'}, {'astronaut': 'Chris Cassidy', 'date': '2020-02-21', 'duration': '06:45:00', 'description': 'Replaced a faulty pump on the JEM-EF and installed new batteries on the Kibo laboratory module.'}, {'astronaut': 'Douglas Hurley', 'date': '2020-05-30', 'duration': '06:58:00', 'description': 'Installed new batteries on the JEM-EF and replaced a faulty pump on the Kibo laboratory module.'}, {'astronaut': 'Victor Glover', 'date': '2020-10-27', 'duration': '06:32:00', 'description': 'Replaced a faulty pump on the JEM-EF and installed new batteries on the Kibo laboratory module.'}, {'astronaut': 'Shane Kimbrough', 'date': '2021-03-18', 'duration': '06:49:00', 'description': 'Installed new batteries on the JEM-EF and replaced a faulty pump on the Kibo laboratory module.'}, {'astronaut': 'Megan McArthur', 'date': '2021-09-16', 'duration': '06:38:00', 'description': 'Replaced a faulty pump on the JEM-EF and installed new batteries on the Kibo laboratory module.'}, {'astronaut': 'Akihiko Hoshide', 'date': '2022-04-28', 'duration': '06:42:00', 'description': 'Installed new batteries on the JEM-EF and replaced a faulty pump on the Kibo laboratory module.'}, ] for data in space_walks_data: SpaceWalks.objects.create( astronaut=data['astronaut'], date=datetime.strptime(data['date'], '%Y-%m-%d').date(), duration=timedelta(hours=int(data['duration'][:2]), minutes=int(data['duration'][3:5]), seconds=int(data['duration'][6:])), description=data['description'] ) class Migration(migrations.Migration): dependencies = [ ('space_walks', '0001_initial'), ] operations = [ migrations.RunPython(create_space_walks), ]