diff options
Diffstat (limited to 'app/birds')
-rw-r--r-- | app/birds/admin.py | 22 | ||||
-rw-r--r-- | app/birds/migrations/0007_auto_20170821_1415.py | 36 | ||||
-rw-r--r-- | app/birds/migrations/0008_auto_20170821_1418.py | 20 | ||||
-rw-r--r-- | app/birds/migrations/0009_auto_20170821_1429.py | 20 | ||||
-rw-r--r-- | app/birds/migrations/0010_auto_20170906_2100.py | 25 |
5 files changed, 108 insertions, 15 deletions
diff --git a/app/birds/admin.py b/app/birds/admin.py index aa2aabb..b5c6a7e 100644 --- a/app/birds/admin.py +++ b/app/birds/admin.py @@ -1,22 +1,9 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from birds.models import BirdSighting, BirdAudio, BirdClass, Bird -from django.contrib.gis.geos import GEOSGeometry from photos.forms import GalleryForm -from daily.models import CheckIn - - -def convertll(lat, lon): - pnt = GEOSGeometry('POINT({0} {1})'.format(lon, lat), srid=4326) - pnt.transform(3857) - return pnt.y, pnt.x - - -def get_latlon(): - loc = CheckIn.objects.latest() - lat_converted, lon_converted = convertll(loc.lat, loc.lon) - return lat_converted, lon_converted +from utils.util import get_latlon class BirdClassAdmin(admin.ModelAdmin): @@ -31,9 +18,14 @@ class BirdAdmin(admin.ModelAdmin): list_display = ('pk', 'common_name', 'scientific_name', 'code', 'bird_class') list_filter = ('bird_class',) +class GalleryFormPlus(GalleryForm): + def __init__(self, *args, **kwargs): + super(GalleryFormPlus, self).__init__(*args, **kwargs) + self.base_fields['seen_by'].widget = CustomSelectMultiple() + class BirdSightingAdmin(OSMGeoAdmin): - form = GalleryForm + form = GalleryFormPlus list_filter = ( ) list_display = ('bird', 'location') diff --git a/app/birds/migrations/0007_auto_20170821_1415.py b/app/birds/migrations/0007_auto_20170821_1415.py new file mode 100644 index 0000000..a51776c --- /dev/null +++ b/app/birds/migrations/0007_auto_20170821_1415.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-08-21 14:15 +from __future__ import unicode_literals + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ('birds', '0006_auto_20170714_2224'), + ] + + operations = [ + migrations.AlterModelOptions( + name='birdsighting', + options={'get_latest_by': 'date', 'verbose_name_plural': 'Bird Sighting'}, + ), + migrations.RemoveField( + model_name='birdsighting', + name='images', + ), + migrations.AddField( + model_name='birdsighting', + name='image', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + ), + migrations.AlterField( + model_name='birdsighting', + name='point', + field=django.contrib.gis.db.models.fields.PointField(blank=True, srid=4326), + ), + ] diff --git a/app/birds/migrations/0008_auto_20170821_1418.py b/app/birds/migrations/0008_auto_20170821_1418.py new file mode 100644 index 0000000..e5c80a4 --- /dev/null +++ b/app/birds/migrations/0008_auto_20170821_1418.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-08-21 14:18 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('birds', '0007_auto_20170821_1415'), + ] + + operations = [ + migrations.RenameField( + model_name='birdsighting', + old_name='image', + new_name='images', + ), + ] diff --git a/app/birds/migrations/0009_auto_20170821_1429.py b/app/birds/migrations/0009_auto_20170821_1429.py new file mode 100644 index 0000000..840d7d3 --- /dev/null +++ b/app/birds/migrations/0009_auto_20170821_1429.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-08-21 14:29 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('birds', '0008_auto_20170821_1418'), + ] + + operations = [ + migrations.RenameField( + model_name='birdsighting', + old_name='images', + new_name='image', + ), + ] diff --git a/app/birds/migrations/0010_auto_20170906_2100.py b/app/birds/migrations/0010_auto_20170906_2100.py new file mode 100644 index 0000000..aada189 --- /dev/null +++ b/app/birds/migrations/0010_auto_20170906_2100.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-09-06 21:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ('birds', '0009_auto_20170821_1429'), + ] + + operations = [ + migrations.RemoveField( + model_name='birdsighting', + name='image', + ), + migrations.AddField( + model_name='birdsighting', + name='images', + field=models.ManyToManyField(blank=True, to='photos.LuxImage'), + ), + ] |