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.
1,635
questions
0
votes
0
answers
18
views
Tastypie Django full hydrate returns an error when joining the protected Resource
I created here a small example to explain my problem for which I haven't find a solution on the web.
I am using Django and Tastypie to implement a REST API. I have MyUserResource which is a descendant ...
0
votes
1
answer
27
views
How to use raw query in django tastypie and join tables?
I am trying to use a raw query in django tastypie queryset.
But django is throwing me the following exception:
<error_message>'RawQuerySet' object has no attribute 'filter'</error_message>
...
0
votes
1
answer
33
views
What is the best way to save comma separated keywords posted from client side into database table using Django?
I have a text area input on a simple HTML page, where I am posting comma-separated keywords to save into my database table.
For example,
Keywords input is like: keyword1,keyword2,keyword3, ...
I am ...
0
votes
0
answers
32
views
Django Tastypie - Inserting parent and child objects in a single atomic transaction
I am trying to implement REST API using PostgreSQL, Tastypie and Django. I managed to implement [GET] API endpoint, but I'm having troubles with implementing [POST] API operation. The cause of my ...
0
votes
0
answers
15
views
Tastypie queries for all fields, is it possible to only SELECT specific fields
With tastypie you create a resource for your Django model and point the queryset at your model.objects.all().
I was expecting "fields" to allow me to declare which fields i want to return: ...
0
votes
0
answers
18
views
Tastypie: ending empty POST with no request, and to a path parameter URL
I need to create two POST request with url:
/create with raw body: {some JSON}, I'm able to do this,
with a obj_create method provided by tastypie.
/create/4, I'm stuck at this, which has the same ...
0
votes
1
answer
60
views
Problem when import ModelResource from tastypie.resources
I am new to Django and I want to create some API with tastypie, but when I import ModelResource from tastypie.resource I face with error :/
I just do this:
from tastypie.resources import ModelResource
...
0
votes
1
answer
621
views
ModuleNotFoundError: No module named 'tastypie'
I am new to Django and coding in general.
When I try to use the django-tastypie (0.14.4) in my virtual env using pipenv, I get the following error when I try to launch the server ModuleNotFoundError: ...
2
votes
0
answers
103
views
Tastypie: How can I create an "abstract" ModelResource class with a Meta class
Using django-tastypie I'd like to create a child class of ModelResource to define some common things, which all my other API resource classes would inherit from. e.g.:
class MyModelResource(...
0
votes
0
answers
177
views
Problem importing ModelResource from tastypie.resources
Good day, I'm currently on the middle of a practice project for django and can't seem to find a solution to a problem when creating an api with tastypie. I'm currently in the middle of learning so any ...
3
votes
1
answer
111
views
How to wrap custom endpoints in Django Tastypie?
I want to add a dispatch method to some resource so I could use a wrapper decorator on it.
The issue is that it only works on the CRUD operations and wont go into the dispatch method on 'original' ...
0
votes
1
answer
67
views
Sending a file with json with requests and tastypie
I'm trying to send some zip files, and some json to my tastypie endpoint.
I'm getting:
The format indicated \'multipart/form-data\' had no available deserialization method. Please check your ``formats`...
0
votes
0
answers
37
views
Sending large zip files to Django/Tastypie server
I want to send some zip files from a raspberry Pi to my windows server. The zips are about 2GB each.
I'm using python sockets to send them.
def sendFile():
s = socket.socket(socket.AF_INET,socket....
0
votes
1
answer
86
views
Tastypie resource filtering through foreign keys
I have some Django (3.1) models connected through foreign keys
class Drone(models.Model):
serial = models.CharField(max_length=200, null=False, unique=True)
class Dive(models.Model):
...
-1
votes
1
answer
666
views
how can save file with names in utf-8
I need to save file with utf-8 names.but when I do it django error:
UnicodeEncodeError at /uploaded/document/ 'فیلتر.png'
'ascii' codec can't encode characters in position 55-59: ordinal not in range(...
0
votes
1
answer
242
views
Memory Error while doing `request.POST.copy()'
I have a Django application that allows users to upload files.
I do that using tastypie rest, it works perfectly with normal size files.
but an error occurs when uploading a 500MB file.
the error ...
0
votes
1
answer
218
views
How reverse an include pattern path in Django
Hi i am wondering how i can reverse a urlpattern path that uses include pattern. Since there is no namespace i don't know how to reverse it.
Also i am new to Django so all this is a little bizarre to ...
0
votes
1
answer
47
views
Why i am i encountering DrawingProfile.DoesNotExist Exception in Django?
I am trying to resolve a bug in the API from a code i inherited. I am new to Django and tastypie so i don't know how to resolved this. I have imported my model but i do not know why i am getting ...
2
votes
1
answer
431
views
How user authentication is different than session authentication
I am new to Django and I am trying to write some APIs. Django has user-based authentication request.user.is_authenticated() to check whether a valid user is logged in or not.
There is also session ...
1
vote
0
answers
126
views
Why request.body is empty on call custom API using tastypie?
Facing issue with POST API call. I am using tastypie prepend_urls wrap_view for login custom api.
I am using below versions:
Tastypie 0.14.3
Tastypie_swagger 0.1.4
Django 2.2.12
Python 3.5.2
...
0
votes
1
answer
54
views
How to perform conditional column update in Django Tastypie
I want to update count conditionally, if count = 1, update count = 10.
class HelloModel(Model):
count = models.IntegerField()
class HelloModelResource(Resource)
def obj_update(self, bundle, ...
0
votes
1
answer
34
views
How to get multiple ressources using one URI?
When I issue this curl command:
curl http://localhost/refeq/v1/vehiclesequipements/?format=json -s | jq .
I get:
{
"objects":[
{
"vehicle_id": 9759,
"resource_uri": "/refeq/v1/...
1
vote
1
answer
205
views
Changing the queryKey argument in bootstrap autocomplete
I am using bootstrap autocomplete to fetch data from django-tastypie.
The problem that I am facing is that bootstrap autocomplete uses a parameter q, while tastypie has all the regular django options....
1
vote
1
answer
57
views
pre_save signal using tastypie api not allowing me to access "instance" field
I'm working on this small Django project in which I'm using pre_save signals to update a table in which I save the cumulative value of a certain quantity, whenever a new Transaction is created or ...
0
votes
1
answer
410
views
Creating a user history API in Django
I am new to Django, I am using it to build a server where a person can create an account, then add online newspaper articles that they have viewed. I want the user to be able to view all of the ...
1
vote
1
answer
351
views
How to get minutes/hours/seconds from a django request?
I wanna retrieve time fields separately from a request. But when I try to process values, HttpResponse gives 406 status code.
def ReservationActions(request):
if(request.method == 'POST'):
...
1
vote
0
answers
94
views
Tastypie annoate / groupby returns a "pk" error
When using django's annotate to get a "group by" it makes sense it returns objects without PK. As it wouldn't make sense to group by a field, sum up some other fields, and get single row PK IDs.
I ...
0
votes
1
answer
203
views
How to convert a Django model instance to JSON using existing Tastypie Resource?
This problem is related to this other problem, but instead, I wish to convert a single model instance to JSON, using an existing Tastypie Resource.
0
votes
1
answer
34
views
How to use a part of URL to filter models? (using tastypie)
Hello this is my first post. I have an api app using tastypie. It reads models from database. I would like to use a part of the api url to filter on certain objects. No arguments, just a part of url. ...
0
votes
1
answer
113
views
django_tastypie can't recognize url
I am starting a new project with Django and neo4j, and the most promising library for developing REST services is TastyPie (Django Rest Framework is to tied to ORM, and neo4j is not a relational ...
0
votes
0
answers
48
views
GAE, from tastypie import api causes "NotImplementedError: Only tempfile.TemporaryFile is available for use"
Need some help on this Tastypie error on Google app engine. The code worked fine on GAE for long time. Suddendly, it has some weird error when import tastypie api.
Not sure if due to mismatch of ...
0
votes
2
answers
109
views
Using tastypie to retrieve data from foreign key
These are two models in my Django app :
models.py
class Posts(models.Model):
title = models.CharField(max_length=200, blank=True)
author = models.ForeignKey(user,on_delete=models.CASCADE,...
4
votes
0
answers
425
views
Storing an object with related model results in IntegrityError: null value violates not null constraint
I am having the following problem with using Django and Tastypie. Strangely for about a year or so the following worked flawlessly. Now when I am trying to edit the Car on an Owner and store the Owner ...
1
vote
0
answers
92
views
In Tastypie with nested resources, for a given url, what is the best way to get the view function name?
I can get the view name through the following steps
Get the View name of the child resource
from django.core.urlresolvers import resolve
resolve(/api/v1/parent/child).view_name
api_get_children
...
0
votes
1
answer
77
views
TastyPie - filtering on related resources
Let's say I have two TastyPie resources:
class LicenseResource(ModelResource):
...
class UserResource(ModelResource):
license = fields.ForeignKey(LicenseResource, 'license', full=False, ...
2
votes
0
answers
285
views
migrate from tastypie to DRF
I'm working on django-tastypie project and I want to migrate to django rest framework.
I need an article or a document or anything else that help me to this.
for example this document bring a sample ...
0
votes
1
answer
196
views
How to create records when a model has one-to-many self referential relationship using TastyPie?
I am making POST requests using TastyPie. The Task model has a one-to-many self referential relationship via the parent_task_id field.
Model:
class Task(models.Model):
title = models.CharField(...
1
vote
2
answers
71
views
Django + Testypie Issue: AppRegistryNotReadyException
I'd been trying Testipie with Django and got an AppRegistryNotReady Exception. I'd found a few ways how to fix that but anything didn't help.
Python: 3.6
Django: 2.1.2
django-tastypie: 0....
1
vote
0
answers
69
views
Django Tastypie - Resource on Model Subclasses
I have the following structure in my django models (django version 1.7)
models.py
class Contact(models.Model):
email = models.CharField(verbose_name='Email', max_len=50)
class Person(...
1
vote
1
answer
40
views
Django tastypie: User sees no data
I want to add authentication to my API, so only authorized people can see the data.
To my resource class I added:
authentication = BasicAuthentication()
authorization = DjangoAuthorization()
Then I ...
0
votes
1
answer
306
views
Django Tastypie filter OR statement
Suppose I'm filtering products in the Django Tastypie API and I want to return all products with product_type = 'cracker' OR product_name = 'oreo'. Using this syntax:
localhost:8000/api?product_type=...
0
votes
0
answers
38
views
Django ManyToMany relationship having through parameter [duplicate]
I have the following models for one of my Django apps:
class Product(models.Model):
product_name = models.CharField(max_length=50)
description = models.CharField(max_length=150)
class Seller(...
0
votes
1
answer
162
views
How to prevent update a column in Tastypie
class Hello(models.Model):
name = models.CharField(max_length=8, blank=True)
column_create_no_update = models.CharField(max_length=8, blank=True)
class HelloResource(ModelResource):
def ...
0
votes
1
answer
72
views
Any way for dehydrate() to share an object during an API call in tastypie?
Is there any way for the dehydrate function in tastypie to share some variable? In any other framework, every request would create a new instance of the class, so we can use self to share data.
My ...
0
votes
1
answer
167
views
tastypie group by value
Using tastypie. I have the following simple model:
class Autocomplete(models.Model):
tablename = models.CharField(max_length=50, blank=True) #
fieldname = models.CharField(max_length=25, ...
0
votes
1
answer
32
views
Stop repeating related objects in tastypie
Hey there I'm new to django tastypie and I need a help where my data is getting repeated
I've this model for my todo task and subtask.
class Todo(models.Model):
title = models.CharField(...
0
votes
1
answer
51
views
Transform POST Data Before Persisting [closed]
I am writing an API with TastyPie that a Django application will hit. One of the POST endpoints must validate data before inserting into the db. The process includes checking a record in another ...
0
votes
0
answers
167
views
Tastypie sending POST to update Foreign Key
I've recently got started with Django (and python generally!), and I was looking to use Tastypie in order to automate additions to my database.
For my current problem I have two tables in my ...
1
vote
1
answer
172
views
Extending tastypie API with related objects
I'm new to Django, Tastypie and asking questions here.
I've got a Django application with an API using Tastypie. If I make a GET request to /api/v1/ou/33/, my API returns the object with the id==33, ...
0
votes
1
answer
115
views
Exposing Django model method using TastyPie with Authentication
I'm trying to expose my Django model method using TastyPie and secure resulting endpoint by using BasicAuthentication, also I need to pass Django user authenticated with BasicAuthentication into my ...