Created
March 22, 2013 14:36
-
-
Save eofs/5221729 to your computer and use it in GitHub Desktop.
Use of DRF Proxy's RemoteModels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from rest_framework_proxy.db.models import ProxyModel | |
class Snippet(ProxyModel): | |
name = models.CharField(max_length=25) | |
body = models.TextField(blank=True) | |
@staticmethod | |
def get_resource_class(): | |
return 'core.resources.SnippetResource' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework_proxy.db import resources | |
from core.models import Snippet | |
class SnippetResource(resources.RemoteResource): | |
model = Snippet | |
auth = ('myUsername', 'myPassword') | |
url = 'http://localhost:8080/api/snippets/' | |
headers = { | |
'Accept': 'application/json', | |
} | |
class Meta: | |
result_root = 'results' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment