auto-gen the REST api url list
diff --git a/planetstack/apigen/api.template.py b/planetstack/apigen/api.template.py
index e3f1b64..89a2b18 100644
--- a/planetstack/apigen/api.template.py
+++ b/planetstack/apigen/api.template.py
@@ -7,6 +7,7 @@
 from core.models import *
 from django.forms import widgets
 from rest_framework import filters
+from django.conf.urls import patterns, url
 
 """
     Schema of the generator object:
@@ -22,7 +23,14 @@
     TODO: Deal with subnets
 """
 
-# Based on api_root.py
+def get_REST_patterns():
+    return patterns('',
+        url(r'^plstackapi/$', api_root),
+    {% for object in generator.all %}
+        url(r'plstackapi/{{ object.rest_name }}/$', {{ object.camel }}List.as_view(), name='{{ object.singular }}-list'),
+        url(r'plstackapi/{{ object.rest_name }}/(?P<pk>[a-zA-Z0-9\-]+)/$', {{ object.camel }}Detail.as_view(), name ='{{ object.singular }}-detail'),
+    {% endfor %}
+    )
 
 @api_view(['GET'])
 def api_root(request, format=None):
diff --git a/planetstack/apigen/modelgen b/planetstack/apigen/modelgen
old mode 100755
new mode 100644
index b403c0b..8d25615
--- a/planetstack/apigen/modelgen
+++ b/planetstack/apigen/modelgen
@@ -55,6 +55,24 @@
 			else:
 				return name+'s'
 
+        def singular(self):
+            return str(self)
+
+        def rest_name(self):
+            # These are things that either for historic reasons or due to incorrect naming,
+            # got called something different than the autogen thinks they should be
+            # called.
+            REST_FIXUP = {'networkdeploymentses': 'networkdeployments',
+                            'imagedeploymentses': 'imagedeployments',
+                            'slicedeploymentses': 'slice_deployments',
+                            'userdeploymentses': 'user_deployments',
+                            'sitedeploymentses': 'sitedeployments',
+                            'siteroles': 'site_roles',
+                            'sliceprivileges': 'slice_privileges',
+                            'sliceroles': 'slice_roles',
+                            }
+            return REST_FIXUP.get(self.plural(), self.plural())
+
 	def camel(self):
 		name = str(self.model.__name__)
 		return name