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
# NOTE: This code was extracted from a larger class and has not been | |
# tested in this form. Caveat emptor. | |
import django.conf | |
import django.contrib.auth | |
import django.core.handlers.wsgi | |
import django.db | |
import django.utils.importlib | |
import httplib | |
import json | |
import logging |
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 tastypie import fields | |
from tastypie.authentication import Authentication | |
from tastypie.authorization import Authorization | |
from tastypie.bundle import Bundle | |
from tastypie.exceptions import NotFound | |
from tastypie.resources import Resource | |
# a dummy class representing a row of data | |
class Row(object): |
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
""" | |
module mydjangolib.bigint_patch | |
A fix for the rather well-known ticket #399 in the django project. | |
Create and link to auto-incrementing primary keys of type bigint without | |
having to reload the model instance after saving it to get the ID set in | |
the instance. | |
Logs: |
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
class UserResource(ModelResource): | |
def cached_obj_get(self, request=None, **kwargs): | |
if request and 'id' in kwargs and kwargs['id'] == 'self': | |
return request.user | |
return super(UserResource, self).cached_obj_get(request, **kwargs) | |
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 tastypie import fields | |
from tastypie.authentication import Authentication | |
from tastypie.authorization import Authorization | |
from tastypie.bundle import Bundle | |
from tastypie.exceptions import NotFound | |
from tastypie.resources import Resource | |
# a dummy class representing a row of data | |
class Row(object): |