Retrieving Unrelated Objects in Django REST Framework

2020-01-20 Thread Foobar
My model consists of 3 classes: Offer, Application, and Contract. Relationships are as follows: (1) Application to Offer: One to One (2) Application to Contract: One to One Is there a way for me to access Contract from Offer via Application in a single REST call? I know how to access Appl

REST Calls to Filter Based On Greater Than, Less Than, or Range

2019-01-03 Thread Foobar
Has anyone successfully used DRF to make API calls using gte, lte, and range? If so, what extension did you use? I've tried django-filters and django-rest-framework-filters but neither work as stated. If someone can share their code that would be much appreciated. Thanks. -- You received this

Custom Mixin for Mulitple Field Object Lookup in Django REST

2018-12-13 Thread Foobar
I have the following code which doesn't work: In models.py: class Unit(models.Model): unit_name = models.CharField(max_length=255) In views.py: class MultipleFieldLookupMixin(object): """ Apply this mixin to any view or viewset to get multiple field filtering based on a `lookup_fields` attri

RBAC with DRF

2018-11-29 Thread Foobar
Any suggestions on what I should use to integrate RBAC with DRF? I have taken a look at django-rest-framework-roles and django-guardian but neither look too promising. Your feedback would be much appreciated. Thanks in advance. -- You received this message because you are subscribed to the Goo

Django Oauth Toolkit: POST to Token Generation Service Fails but Curl Succeeds

2018-11-13 Thread Foobar
Using Django OAuth Toolkit, I have authorization_grant_type set to password and skip_authorization set to true. I am able to generate tokens and refresh tokens using curl without an issue using the following command: curl -X POST -d "grant_type=password&username=username&password=password"

Generate Token Using Code Instead of Curl from DOT

2018-11-12 Thread Foobar
How do I obtain a token from Django OAuth Toolkit using my Django code instead of via a call to curl? I've registered an application and have a client ID/secret. Also, my authorization grant type is authorization-code not password. All the example I have seen use password and changing password

Django REST Framework with Django OAuth Toolkit

2018-11-05 Thread Foobar
I have a Django app that is an API which uses DRF and another Django app which uses DOT. I would like these to function as independent micro-services and not be coupled in the same Django app. All the examples I have seen point to DRF and DOT being coupled in the same Django app. Can anyone she

Django OAuth Toolkit Login Template

2018-11-01 Thread Foobar
I'm trying to create an OAuth server using the following instructions: https://django-oauth-toolkit.readthedocs.io/en/latest/tutorial/tutorial_01.html Where can I find the login template with path registration/login.html? Is this a template I have to create inside directory /registration? The i

Multi-Level Nested Relationships with DRF

2018-10-31 Thread Foobar
Has anyone implemented multiple levels of nested relationships with DRF? If so, did you use an extension for this purpose? I've investigated several different options including DRF extensions but don't know which one will work the best for multi-level nested relationships. Also, if you can share

Re: Custom Mixin for Mulitple Field Object Lookup in Django REST

2018-10-31 Thread Foobar
key or other attribute. Is this possible >>>> using filtering if URLs are being defined using routers? >>>> >>>> On Tue, Oct 30, 2018 at 8:23 AM Alan Crosswell >>> > wrote: >>>> >>>>> This seems like you are reinve

Re: Custom Mixin for Mulitple Field Object Lookup in Django REST

2018-10-30 Thread Foobar
Thanks Jason. Now, the get_object function in class MultipleFieldLookupMixin is actually being called but it's throwing an error as follows: if self.kwargs[field]: # Ignore empty fields. KeyError: 'unit_name' The ViewSet is defined as follows: class UnitViewSet(CountModelMixin, MultipleFieldLo

Custom Mixin for Mulitple Field Object Lookup in Django REST

2018-10-29 Thread Foobar
I have the following code which doesn't work: In models.py: class Unit(models.Model): unit_name = models.CharField(max_length=255) In views.py class MultipleFieldLookupMixin(object):""" Apply this mixin to any view or viewset to get multiple field filtering based on a `lookup_fields` attri