Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Django Rest framework(drf) support #471

Open
pushyamig opened this issue Oct 31, 2024 · 1 comment
Open

Add Django Rest framework(drf) support #471

pushyamig opened this issue Oct 31, 2024 · 1 comment

Comments

@pushyamig
Copy link
Contributor

https://www.django-rest-framework.org/

@pushyamig pushyamig assigned pushyamig and unassigned pushyamig Nov 1, 2024
@smbd1368
Copy link

smbd1368 commented Nov 2, 2024

first step:
pip install djangorestframework

second step:
INSTALLED_APPS = [
...
'rest_framework',
]

third step:
from rest_framework import serializers
from .models import MyModel

class MyModelSerializer(serializers.ModelSerializer):
class Meta:
model = MyModel
fields = 'all' # Or specify specific fields

fourth step:

from rest_framework import viewsets
from .models import MyModel
from .serializers import MyModelSerializer

class MyModelViewSet(viewsets.ModelViewSet):
queryset = MyModel.objects.all()
serializer_class = MyModelSerializer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants