Skip to content

Instantly share code, notes, and snippets.

View mosi-kha's full-sized avatar

mostafa khaki mosi-kha

View GitHub Profile
mosi-kha /
Created July 11, 2021 07:04
MongoDB Object Id field for DRF serializer
from bson import ObjectId
from bson.errors import InvalidId
from django.utils.encoding import smart_str
from rest_framework import serializers
class ObjectIdField(serializers.Field):
"""Field for ObjectId values"""
def to_internal_value(self, value):
mosi-kha /
Last active July 11, 2021 07:05
versioning API in falcon framework v2


first in your route, use this base url : /api/{version}


then create this file:

import falcon

class UriVersion:
 def __init__(self, version: list):