This file contains hidden or 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 multiprocessing import cpu_count | |
import threading | |
import queue | |
import logging | |
logger = logging.getLogger(__name__) | |
class ThreadQueue(object): |
This file contains hidden or 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
# | |
# Token Manager | |
# https://docs.djangoproject.com/en/1.10/topics/signing/ | |
# | |
from django.core import signing | |
from django.contrib.auth import get_user_model | |
class TemporaryApiToken(): | |
""" |
This file contains hidden or 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
import sys | |
from twisted.internet import inotify, reactor, threads | |
from twisted.python import filepath | |
# Resources: | |
# Introduction to Deferreds: | |
# http://twisted.readthedocs.io/en/twisted-16.1.1/core/howto/defer-intro.html | |
# Returning Deferreds from synchronous functions: | |
# https://twistedmatrix.com/documents/current/core/howto/gendefer.html#returning-deferreds-from-synchronous-functions |
This file contains hidden or 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 twisted.internet import inotify, reactor, threads | |
from twisted.python import filepath | |
# Resources: | |
# Introduction to Deferreds: | |
# http://twisted.readthedocs.io/en/twisted-16.1.1/core/howto/defer-intro.html | |
# Returning Deferreds from synchronous functions: | |
# https://twistedmatrix.com/documents/current/core/howto/gendefer.html#returning-deferreds-from-synchronous-functions | |
# addCallbacks Docs: | |
# https://twistedmatrix.com/documents/16.1.1/api/twisted.internet.defer.Deferred.html#addCallbacks |
This file contains hidden or 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 import serializers | |
class DynamicFieldsModelSerializer(serializers.ModelSerializer): | |
""" | |
A ModelSerializer that allows for optional fields to be added to a | |
serializer. These fields only appear when they are referred to by | |
name with a `include` GET parameter. | |
Additionally, a user can provide a `fields` GET parameter to limit |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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.contrib import admin, messages | |
from django.shortcuts import render | |
from my_app.models import MyModel | |
from my_app import forms | |
class MyModelAdmin(admin.ModelAdmin): | |
actions = ['my_action'] |