add spatialite to settings for gis

This commit is contained in:
Fred 2016-08-02 20:53:18 +02:00
parent 8fcb70fdee
commit 1572f5fcc2
5 changed files with 46 additions and 6 deletions

View File

@ -75,13 +75,14 @@ TEMPLATES = [
WSGI_APPLICATION = 'rdbk.wsgi.application'
SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

View File

@ -2,9 +2,6 @@ from django.contrib import admin
from travel.models import Travel, Event
admin.site.register(Travel)
class TravelAdmin(admin.ModelAdmin):
model = Travel

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-02 18:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('travel', '0002_auto_20160802_1505'),
('travel', '0004_auto_20160711_2000'),
]
operations = [
]

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-02 18:43
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('travel', '0005_merge'),
]
operations = [
migrations.AlterModelOptions(
name='event',
options={'ordering': ['step']},
),
migrations.AddField(
model_name='event',
name='where',
field=django.contrib.gis.db.models.fields.PointField(default=None, srid=4326),
preserve_default=False,
),
]

View File

@ -1,4 +1,4 @@
from django.db import models
from django.contrib.gis.db import models
from django.contrib.auth.models import User
@ -20,7 +20,7 @@ class Event(models.Model):
"""
when = models.DateField()
what = models.CharField(max_length=255)
#where = LatLongField()
where = models.PointField()
step = models.IntegerField()
travel = models.ForeignKey(Travel, related_name='events')