Commit 242ecdab authored by Ben Waters's avatar Ben Waters

Work on geo model

parent 82d174e1
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="ffREST/" />
<option name="manageScript" value="" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.5 (/usr/bin/python)" project-jdk-type="Python SDK" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<module fileurl="file://$PROJECT_DIR$/.idea/friendfinder.iml" filepath="$PROJECT_DIR$/.idea/friendfinder.iml" />
<component name="DependencyValidationManager">
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
This diff is collapsed.
......@@ -4,9 +4,13 @@ from rest_framework.authtoken.views import obtain_auth_token
from rest_framework import routers
from django.contrib import admin
from geo.views import LocationViewSet
router = routers.DefaultRouter()
router.register(r'locations', LocationViewSet)
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'ffREST.views.home', name='home'),
from django.contrib import admin
from .models import Location
# Register your models here.
class LocationAdmin(admin.ModelAdmin):
pass, LocationAdmin)
......@@ -9,7 +9,10 @@ class Location(models.Model):
objects = models.GeoManager()
def __unicode__(self): # __unicode__ on Python 2
def __unicode__(self):
class LocationSerializer(serializers.ModelSerializer):
class Meta:
model = Location
fields = ('id', 'name', 'area', 'lon', 'lat')
from django.shortcuts import render
from rest_framework import viewsets
from rest_framework import permissions
from .models import Location, LocationSerializer
# Create your views here.
class LocationViewSet(viewsets.ModelViewSet):
queryset = Location.objects.all()
serializer_class = LocationSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly,
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