Skip to content

Instantly share code, notes, and snippets.

View jadhavmanoj's full-sized avatar
🎯
Focusing

Manoj Jadhav jadhavmanoj

🎯
Focusing
View GitHub Profile
@jadhavmanoj
jadhavmanoj / drf_viewset.py
Last active October 16, 2020 06:45
Call DRF viewset pythonically.
from rest_framework.request import Request
from django.http import HttpRequest
from django.contrib.auth.models import User
from apps.base.views import SampleViewSet
django_request = HttpRequest()
# create HTTP request skipping token here
django_request.method = 'GET'
drf_request = Request(django_request)
@jadhavmanoj
jadhavmanoj / taskenqueue.py
Last active April 2, 2019 07:53
Add task in SQS queue without delay, apply async function from lambda
# Author: Manoj jadhav
from __future__ import print_function
import json
import urllib
import boto3
import uuid
import base64
sqs = boto3.client("sqs")
@jadhavmanoj
jadhavmanoj / gist:ed6bc29a2c35241234a2d98f9b821cc9
Created April 1, 2019 07:21
python3- Pycurl installation failed on ubuntu16
I got this error:
In file included from src/docstrings.c:4:0:
src/pycurl.h:4:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
@jadhavmanoj
jadhavmanoj / DRF Soft delete mixin
Last active March 25, 2022 06:35
Django Rest Framework (DRF) Soft delete Mixin.
# in DRF DestroyModelMixin delete row. Using Same DELETE method I can soft delete object.
# ex: URL - DELETE https://<hostnam>/api/v1/books/1/
from rest_framework import mixins, permissions, viewsets
from rest_framework.response import Response
from rest_framework import status
class SlSoftDeleteMixin(mixins.DestroyModelMixin):
""" As we are deleting soft"""