diff --git a/map/migrations/0004_auto_20190302_1455.py b/map/migrations/0004_auto_20190302_1455.py new file mode 100644 index 0000000..6d78340 --- /dev/null +++ b/map/migrations/0004_auto_20190302_1455.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.7 on 2019-03-02 14:55 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('map', '0003_friendlocation_friend'), + ] + + operations = [ + migrations.AlterField( + model_name='friendlocation', + name='friend', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/map/migrations/0005_auto_20190302_1457.py b/map/migrations/0005_auto_20190302_1457.py new file mode 100644 index 0000000..4cf183f --- /dev/null +++ b/map/migrations/0005_auto_20190302_1457.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.7 on 2019-03-02 14:57 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('map', '0004_auto_20190302_1455'), + ] + + operations = [ + migrations.AlterField( + model_name='friendlocation', + name='friend', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='location', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/map/models.py b/map/models.py index 6f432fa..5aa574c 100644 --- a/map/models.py +++ b/map/models.py @@ -26,7 +26,7 @@ class FriendLocation(BaseModel): longitude = CoordinateField() start_date = models.DateField('from', blank=True, null=True) end_date = models.DateField('until', blank=True, null=True) - friend = models.ForeignKey(Friend, on_delete=models.CASCADE) + friend = models.OneToOneField(Friend, on_delete=models.CASCADE, related_name='location') @property def latitude_str(self):