forked from hackforla/CivicTechJobs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added models and serializers for COP, roles, skills and project (hack…
…forla#615) * Added models and serializers for COP, roles, skills and project * Updated Project model and registered newly added models in admin.py
- Loading branch information
1 parent
20f9aea
commit 525da2f
Showing
3 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Opportunities | ||
from .models import Opportunities, CommunityOfPractice, Role, Skill, Project | ||
|
||
# Register your models here. | ||
admin.site.register(Opportunities) | ||
admin.site.register(CommunityOfPractice) | ||
admin.site.register(Role) | ||
admin.site.register(Skill) | ||
admin.site.register(Project) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
from rest_framework import serializers | ||
|
||
from ctj_api.models import Opportunities | ||
from ctj_api.models import Opportunities, CommunityOfPractice, Role, Skill, Project | ||
|
||
|
||
class OpportunitiesSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Opportunities | ||
fields = ["id", "role", "subrole", "project"] | ||
|
||
|
||
class CommunityOfPracticeSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = CommunityOfPractice | ||
fields = ['id', 'practice_area', 'description', 'created_at', 'updated_at'] | ||
|
||
|
||
class RoleSerializer(serializers.ModelSerializer): | ||
community_of_practice = CommunityOfPracticeSerializer(read_only=True) | ||
|
||
class Meta: | ||
model = Role | ||
fields = ['id', 'title', 'community_of_practice', 'created_at', 'updated_at'] | ||
|
||
|
||
class SkillSerializer(serializers.ModelSerializer): | ||
roles = RoleSerializer(many=True, read_only=True) | ||
|
||
class Meta: | ||
model = Skill | ||
fields = ['id', 'name', 'roles', 'created_at', 'updated_at'] | ||
|
||
|
||
class ProjectSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Project | ||
fields = ['id', 'people_depot_project_id', 'meeting_times', 'created_at', 'updated_at'] |