Skip to content

Instantly share code, notes, and snippets.

View ivlevdenis's full-sized avatar
🏠
Working from home

Ivlev Denis ivlevdenis

🏠
Working from home
View GitHub Profile
from rest_framework import viewsets
from rest_framework.response import Response
# https://gist.github.com/ivlevdenis/a0c8f5b472b6b8550bbb016c6a30e0be
class ExtendViewSet(object):
"""
This viewset mixin class with extended options list.
"""
@cwisecarver
cwisecarver / base.py
Created May 27, 2016 00:07
Working server_side_cursors in django 1.9
import uuid
import psycopg2
from django.conf import settings
from django.db.backends import utils
from django.db.backends.postgresql.base import \
DatabaseWrapper as PostgresqlDatabaseWrapper
from django.db.backends.postgresql.base import *
@jpadilla
jpadilla / exceptions.py
Created January 15, 2014 00:41
Custom exception handler for Django Rest Framework that adds the `status_code` to the response and renames the `detail` key to `error`.
from rest_framework.views import exception_handler
def custom_exception_handler(exc):
"""
Custom exception handler for Django Rest Framework that adds
the `status_code` to the response and renames the `detail` key to `error`.
"""
response = exception_handler(exc)
@madan712
madan712 / PopupDiv.html
Last active January 18, 2024 18:23
Open Popup div with disabled background using Javascript
<HTML>
<HEAD>
<TITLE>Popup div with disabled background</TITLE>
<style>
.ontop {
z-index: 999;
width: 100%;
height: 100%;
top: 0;
left: 0;