I am trying to create a RESTful API with a django website i have
running. The project folder is called rosebud and inside the folder r2
lies my application.
I have tried to retrieve objects by calling the Users table in
django's default authentication model.
But i have problems retrieving objects from other tables in my
database. Is it something to do with how i defined my model.py?
I have this table called timeline in my database but each time i run
the server and query it, it comes back with an error saying
r2_timeline table does not exist.
the error msg is sound because r2_timeline really does not exist. What
exists is the table TIMELINE.
This is what i have in my models.py:
from tastypie.utils import now
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
class timeline(models.Model):
tweet_id = models.IntegerField(max_length=200)
keyword_id = models.IntegerField(max_length=200, blank=True)
def __unicode__(self):
return self
This is what i have in my api.py file
from django.contrib.auth.models import User
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import DjangoAuthorization
from tastypie import fields
from tastypie.resources import ModelResource
from r2.models import timeline
class timelineResource(ModelResource):
class Meta:
queryset = timeline.objects.all()
resource_name = 'timeline'
excludes = ['id']
include_resource_uri = False
I would appreciate any help i can get to help me get a better idea as
i'm pulling my hair out already. Thank you so much!
Stanwin
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment