Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Ranvijay Sachan ranvijay-sachan

Block or report user

Report or block ranvijay-sachan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ranvijay-sachan
ranvijay-sachan / mixins.py
Created Feb 13, 2019 — forked from adamJLev/mixins.py
Atomic transactions and Django Rest Framework
View mixins.py
from django.db import transaction
class AtomicMixin(object):
"""
Ensures we rollback db transactions on exceptions.
Idea from https://github.com/tomchristie/django-rest-framework/pull/1204
"""
@transaction.atomic()
def dispatch(self, *args, **kwargs):
return super(AtomicMixin, self).dispatch(*args, **kwargs)
@ranvijay-sachan
ranvijay-sachan / auth.py
Created Jul 22, 2017 — forked from koriaf/auth.py
django-oidc-provider and DRF example
View auth.py
"""
NOT PRODUCTION READY
Usage:
REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': (
....
'ibr.users.accounts_api_v0.auth.OidcOauth2Auth'
@ranvijay-sachan
ranvijay-sachan / app.py
Last active Jun 17, 2017
parse unix passwd file
View app.py
import os
from flask import Flask, request, render_template
from network.parse_passwd import get_remote_user_info
app = Flask(__name__)
@app.route('/login')
You can’t perform that action at this time.