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

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:
No preview for this file type
......@@ -27,24 +27,34 @@ TEMPLATE_DEBUG = True
TEMPLATE_DIRS =(os.path.join('templates'))
STATIC_ROOT = 'static'
# Application definition
......@@ -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
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(,
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
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
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