pip install djangorestframework #serializers.py from snips.models import * from rest_framework import serializers class LanguageSerializer(serializers.ModelSerializer): class Meta: model = Language fields = '__all__' extra_kwargs = { 'id': {'read_only': False, 'required': False}, 'language': {'validators': []} } #views.py from rest_framework.decorators import api_view from rest_framework.response import Response from main.models import * from api.serializers import * from rest_framework import status
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter