Exp 9 Employee Management System using Django DRF (1)
Exp 9 Employee Management System using Django DRF (1)
A.2 Prerequisite: HTML, CSS, Javascript, CURD in Django, Postman or Thunder Client
A.3 Outcome:
After successful completion of these applications students will be able to understand Django
DRF Framework
INSTALLED_APPS = [
...,
'rest_framework',
]
3. Create Serializer for Already created Employee Model: In myapp/serializers.py:
class EmployeeSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
fields = ['id', 'name', 'salary']
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering (Mumbai Campus)
IMAD
Lab Manual
"Design and implement a Django-based REST API for managing employee records. This API should
allow clients to perform CRUD operations on employee data.
Hints:
urlpatterns = [
path('api/employees/', views.employee_list, name='employee_list_api'), # List or Create
path('api/employees/<int:id>/', views.employee_detail, name='employee_detail_api'), # Get, Update or Delete
]
Note: Just by using the 2 uri you will be able to perform the basic crud operations
(Students must submit the soft copy as per following segments within two hours of the practical. The
soft copy must be uploaded on the Blackboard or emailed to the concerned lab in charge faculties
at the end of the practical in case the there is no Black board access available)
B.1 Code:
B.2 Output
(Take screen shots of the output at run time and paste it here)
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering (Mumbai Campus)
IMAD
Lab Manual
B.3 Conclusion:
(Students must write the conclusion as per the attainment of individual outcome listed above)
(Students must write their observations and learnings as per the attainment of individual outcome listed
above)
1. How does Django REST Framework (DRF) handle serialization for database models?
2. What is the role of api_view in Django REST Framework?
3. How do you implement authentication and permissions in Django REST Framework?
4. What are the advantages of using class-based views over function-based views in DRF?
5. What is the difference between Serializer and ModelSerializer in Django REST Framework?
6. How does Django REST Framework handle versioning of APIs, and why is it important?