Allow only one location per friend
This commit is contained in:
parent
22ac627f17
commit
e50bf025f9
3 changed files with 41 additions and 1 deletions
20
map/migrations/0004_auto_20190302_1455.py
Normal file
20
map/migrations/0004_auto_20190302_1455.py
Normal file
|
@ -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),
|
||||
),
|
||||
]
|
20
map/migrations/0005_auto_20190302_1457.py
Normal file
20
map/migrations/0005_auto_20190302_1457.py
Normal file
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue