@ -17,7 +17,7 @@ class TeamSerializerBase(serializers.ModelSerializer):
|
||||
model = Team
|
||||
fields = (
|
||||
"id",
|
||||
"name",
|
||||
"team_name",
|
||||
'organization',
|
||||
'url',
|
||||
)
|
||||
@ -66,7 +66,15 @@ class OrganizationSerializer(serializers.ModelSerializer):
|
||||
view_name="_api_organization", format="html"
|
||||
)
|
||||
|
||||
teams = TeamSerializerBase(source='team_set', many=True, read_only=False)
|
||||
teams = serializers.SerializerMethodField('get_url')
|
||||
|
||||
def get_url(self, obj):
|
||||
|
||||
request = self.context.get('request')
|
||||
|
||||
team = Team.objects.get(pk=obj.id)
|
||||
|
||||
return request.build_absolute_uri(reverse('_api_organization_teams', args=[team.organization_id]))
|
||||
|
||||
view_name="_api_organization"
|
||||
|
||||
|
@ -11,6 +11,7 @@ urlpatterns = [
|
||||
path("", index.IndexView.as_view(), name='_api_home'),
|
||||
path("organization/", access.OrganizationList.as_view(), name='_api_orgs'),
|
||||
path("organization/<int:pk>/", access.OrganizationDetail.as_view(), name='_api_organization'),
|
||||
path("organization/<int:organization_id>/teams", access.TeamList.as_view(), name='_api_organization_teams'),
|
||||
path("organization/<int:organization_id>/team/<int:group_ptr_id>/", access.TeamDetail.as_view(), name='_api_team'),
|
||||
path("organization/<int:organization_id>/team/<int:group_ptr_id>/permissions", access.TeamPermissionDetail.as_view(), name='_api_team_permission'),
|
||||
path("organization/team/", access.TeamList.as_view(), name='_api_teams'),
|
||||
|
@ -33,9 +33,17 @@ class OrganizationDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
|
||||
class TeamList(generics.ListCreateAPIView):
|
||||
queryset = Team.objects.all()
|
||||
queryset = Team.objects.filter()
|
||||
serializer_class = TeamSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
|
||||
return Team.objects.filter(organization=self.kwargs['organization_id'])
|
||||
|
||||
|
||||
def get_view_name(self):
|
||||
return "Organization Teams"
|
||||
|
||||
|
||||
|
||||
class TeamDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
@ -102,7 +102,7 @@ section h2 span svg {
|
||||
{% endif %}
|
||||
( {% if build_details.project_url %}<a href="{{ build_details.project_url }}/-/commit/{{ build_details.sha }}" target="_blank">{% endif %}
|
||||
{{ build_details.sha }}
|
||||
{% if build_details.url%}</a>{% endif %} )
|
||||
{% if build_details.project_url %}</a>{% endif %} )
|
||||
</span>
|
||||
<span></span>
|
||||
</footer>
|
||||
|
Reference in New Issue
Block a user