Commit 82d174e1 authored by Ben Waters's avatar Ben Waters

Added location settings and model

parent 1823afa3
from django.db import models
# Create your models here.
from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=get_user_model())
def create_auth_token(sender, instance=None, created=False, **kwargs):
if created:
Token.objects.create(user=instance)
No preview for this file type
......@@ -27,24 +27,34 @@ TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
TEMPLATE_DIRS =(os.path.join('templates'))
STATIC_ROOT = 'static'
SITE_ID= 1
# Application definition
INSTALLED_APPS = (
'django.contrib.admindocs',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'push_notifications',
'rest_framework',
'rest_framework.authtoken',
'south',
'core',
'geo',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
#'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
......@@ -65,7 +75,12 @@ DATABASES = {
'USER': 'ffuser',
'PASSWORD': '14ff!',
'HOST': 'localhost',
}
},
'location': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geodjango',
'USER': 'geo',
}
}
# Internationalization
......
No preview for this file type
from django.conf.urls import patterns, include, url
from django.views.decorators.csrf import csrf_exempt
from rest_framework.authtoken.views import obtain_auth_token
from rest_framework import routers
from django.contrib import admin
admin.autodiscover()
router = routers.DefaultRouter()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'ffREST.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^', include(router.urls)),
url(r'^admin/docs/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^api/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^api/authtoken/', obtain_auth_token),
)
from django.contrib import admin
# Register your models here.
from django.contrib.gis.db import models
# Create your models here.
class Location(models.Model):
name = models.CharField(max_length=50)
area = models.IntegerField()
lon = models.FloatField()
lat = models.FloatField()
objects = models.GeoManager()
def __unicode__(self): # __unicode__ on Python 2
return self.name
class
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
7200b4f16e818cd2b13dbbff24a871b97992c17f
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment