Skip to content

Instantly share code, notes, and snippets.

from zeep import Client
from zeep.helpers import serialize_object
from rest_framework import status
import traceback
import sys
from mo_integration.communication import services as communication_service
from .exceptions import (
CriticalBSAPIResponse,
ServiceBSUnavailable,
from troposphere import (
Template,
Parameter,
FindInMap,
Ref,
Output,
GetAtt,
Base64,
Tags,
Join
from django.contrib.auth.models import User
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from requests.exceptions import HTTPError
from rest_framework.exceptions import ValidationError
from rest_framework.generics import GenericAPIView, get_object_or_404
from rest_framework.views import APIView
from rest_framework import viewsets
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
import sys
import os
import time
import boto3
import psycopg2
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

Keybase proof

I hereby claim:

  • I am levivm on github.
  • I am levinvm (https://keybase.io/levinvm) on keybase.
  • I have a public key ASCqa9w1vkgZtovcK4vqF-ktVzrosyE1Mf8gFZ3fA6kQ_Ao

To claim this, I am signing this object:

class SignUpMixin(object):
"""
Mixin for the common SignUp methods
"""
permissions = []
profile_serializer = None
group_name = None
def create_token(self, user):
return Token.objects.create(user=user)
class UnixEpochDateField(serializers.DateTimeField):
def to_representation(self, value):
""" Return epoch time for a datetime object or ``None``"""
if type(value) is time:
d = date.today()
value = datetime.combine(d, value)
class HostingOrderAdmin(admin.ModelAdmin):
# fields = ('slug', 'imdb_link', 'start', 'finish', 'added_by')
list_display = ('id', 'created_at', 'plan', 'user')
search_fields = ['vm_plan__id', 'customer__user__email']
def save_model(self, request, obj, form, change):
if not change:
customer = form.cleaned_data.get('customer')
# Get and set billing address from the lastest charged order
@levivm
levivm / gist:624f9b3fe9598ae35caee229b17c02ea
Last active November 6, 2016 20:50
Test for review api endpoint using django.
# python imports
import json
from datetime import datetime
# third party imports
import mock
# django imports
from django.conf import settings
from django.contrib.auth.models import Permission