Bug fixes
diff --git a/planetstack/apigen/api.template.py b/planetstack/apigen/api.template.py
index 690bb13..0faf947 100644
--- a/planetstack/apigen/api.template.py
+++ b/planetstack/apigen/api.template.py
@@ -2,6 +2,7 @@
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
+from rest_framework import generics
from core.models import *
from django.forms import widgets
@@ -42,7 +43,7 @@
{% endif %}
{% endfor %}
class Meta:
- model = {{ object }}
+ model = {{ object.camel }}
fields = ({% for prop in object.props %}'{{ prop }}',{% endfor %})
{% endfor %}
@@ -57,11 +58,11 @@
{% for object in generator.all %}
class {{ object.camel }}List(generics.ListCreateAPIView):
- queryset = {{ object.camel }}.objects.select_related.all()
+ queryset = {{ object.camel }}.objects.select_related().all()
serializer_class = {{ object.camel }}Serializer
class {{ object.camel }}Detail(generics.RetrieveUpdateDestroyAPIView):
- queryset = {{ object.camel }}.objects.select_related.all()
+ queryset = {{ object.camel }}.objects.select_related().all()
serializer_class = {{ object.camel }}Serializer
{% endfor %}
diff --git a/planetstack/apigen/modelgen b/planetstack/apigen/modelgen
index d2e80f5..e0def4b 100755
--- a/planetstack/apigen/modelgen
+++ b/planetstack/apigen/modelgen
@@ -7,6 +7,8 @@
import re
from django.template import Context, Template
+blacklist = ['SingletonModel','PlCoreBase']
+
# Django set up
sys.path.append('.')
@@ -27,7 +29,7 @@
def enum_classes():
model_classes = []
for c in g.values():
- if type(c)==type(PlCoreBase):
+ if type(c)==type(PlCoreBase) and c.__name__ not in blacklist:
model_classes.append(c)
return model_classes
@@ -50,7 +52,7 @@
def camel(self):
name = str(self.model.__name__)
- return name.title()
+ return name
class Generator(dict):
def all(self):
@@ -67,6 +69,8 @@
def compute_links(self):
for obj in self.values():
+ if (str(obj).lower()=='user'):
+ pdb.set_trace()
fields = obj.model._meta.fields
for f in fields:
if type(f)==ForeignKey and f.name in self.keys():
diff --git a/planetstack/planetstack/urls.py b/planetstack/planetstack/urls.py
index 6c9acfa..9dceea9 100644
--- a/planetstack/planetstack/urls.py
+++ b/planetstack/planetstack/urls.py
@@ -16,7 +16,7 @@
from core.views.slice_privileges import SlicePrivilegeList, SlicePrivilegeDetail
from core.views.slivers import SliverList, SliverDetail
from core.views.tags import TagList, TagDetail
-from core.views.users import UserList, UserDetail
+from genapi import UserList, UserDetail
from core.views.legacyapi import LegacyXMLRPC
from core.models import *
from core.api_root import api_root