Questions tagged [tastypie]

Tastypie is a reusable Django App and is suitable for providing an API to any application without having to modify the sources of that app.

Tastypie is a reusable Django App and is suitable for providing a REST API to any application without having to modify the sources of that app.

1634 questions
14
votes
1 answer

Django and REST API to serve calculation-based requests

I wrote a machine learning application in Django so a user can specify in a form some parameters and train a model. Once the model is trained, I want to serve requests like: curl http://localhost:8000/.../?model_input='XYZ' and I want Django…
Patrick
  • 2,037
  • 3
  • 24
  • 36
14
votes
3 answers

Tastypie documentation generation

I'm trying to use auto-doc tool to generate API doc for Tastypie REST API. I tried Tastytool, but it seems not showing the API's result parameters but the model's columns. Then I tried Sphinx seems more promising since Tastypie supports Sphinx, but…
Jason Xu
  • 2,601
  • 4
  • 25
  • 51
12
votes
4 answers

How do I check that user already authenticated from tastypie?

When user authenticates in Django, how do I check that from tastypie? Once user logs on, the view includes some JS that pulls data from API, which is backed by tastypie. I have basic authentication/djangoauthorisation set up on my resources, so…
rytis
  • 2,599
  • 20
  • 26
12
votes
2 answers

what is the control flow of django rest framework

I am developing an api for a webapp. I was initially using tastypie and switched to django-rest-framework (drf). Drf seems very easy to me. What I intend to do is to create nested user profile object. My models are as below from django.db import…
cutteeth
  • 1,908
  • 3
  • 20
  • 42
12
votes
2 answers

What is the right way to use django-allauth with tastypie?

I'm writing a Django app that uses django-allauth for Facebook integration, and uses django-tastypie for a backend for an iOS app. The iOS app will use the native Facebook iOS SDK. I'd like to be able to sign up and verify both Facebook and…
abeinstein
  • 552
  • 4
  • 11
12
votes
6 answers

How to generate an AccessToken programmatically in Django?

I'm setting up an API. Everything is working. I'm creating a token via OAuth2 python lib. I'm using TastyPie for my API. The problem I'm facing.. is that there is no "create" token method in the AccessToken or Client models. I can create an…
virtuexru
  • 798
  • 1
  • 5
  • 16
12
votes
1 answer

Tastypie APIKey authentication

How does the Tastypie APIKey authentication work? I know there is a signal as mentioned in the documentation: from django.contrib.auth.models import User from django.db import models from tastypie.models import create_api_key…
Christopher H
  • 1,674
  • 5
  • 21
  • 29
12
votes
1 answer

Do RESTful service parameters have to be discoverable?

Preamble: My understanding of REST is shallow at best, so any corrections or clarifications to my questions are welcome. I have a situation where I need the user of a RESTful service to submit an arbitrary real positive number. I therefore assume I…
elhefe
  • 3,034
  • 3
  • 24
  • 41
11
votes
1 answer

Exposing model method with Tastypie

I am currently working on implementing an API into my Django project and Tastypie seemed like it would be most suitable. What I can't seem to work out is how to expose a function within my model using Tastypie. For example, I have this model: class…
Octobox
  • 325
  • 5
  • 7
11
votes
2 answers

CSRF Token in Django and iOS

So I am trying to understand what to do here... I am doing a POST call to my Django server from iOS and I keep getting the 403 Error (Invalid CSRF Token). I am thinking about implementing a function that will return me the token (you will need to be…
abisson
  • 3,975
  • 9
  • 42
  • 66
11
votes
4 answers

how to access POST data inside tastypie custom Authentication

I'm trying to write custom Authentication in tastypie. Basically, I want to do the authentication using the post parameters and I don't want to use the django auth at all, so my code looks something like: class MyAuthentication(Authentication): …
eran
  • 6,148
  • 3
  • 31
  • 48
11
votes
4 answers

Can django-tastypie display a different set of fields in the list and detail views of a single resource?

I would like for a particular django-tastypie model resource to have only a subset of fields when listing objects, and all fields when showing a detail. Is this possible?
Carson
  • 14,915
  • 19
  • 60
  • 82
10
votes
2 answers

Django Tastypie creating new resource that has foreign keys?

I'm trying to make creating new instances with Tastypie work, but I keep getting this error with the foreign keys. Here is my stuff: Models: class SuggestionVote(models.Model): created_by_user = models.ForeignKey(User) date_created =…
ip.
  • 3,126
  • 5
  • 29
  • 41
10
votes
2 answers

Mail request body as well to Django Admin while server error

I am using default logger in Django having following configuration: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { …
r.bhardwaj
  • 1,465
  • 5
  • 23
  • 48
10
votes
2 answers

How to speed up tastypie's queries with ToManyField

In resources.py I have: class CategoryResource(ModelResource): items = fields.ToManyField('ItemResource', 'items', full=True, null=False, readonly=True, related_name='items') class Meta: queryset =…
svfat
  • 1,783
  • 11
  • 29