Skip to content

Commit db73802

Browse files
committed
Use project detail endpoint with admin serializer
Add the `environment_variables` field to this serializer that will be returned only when the user is admin.
1 parent 6d46679 commit db73802

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

readthedocs/projects/tasks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,7 @@ def get_env_vars(self):
663663
})
664664

665665
# Update environment from Project's specific environment variables
666-
env.update(
667-
api_v2.project(self.project.pk).environment_variables().get(),
668-
)
666+
env.update(self.project.environment_variables)
669667

670668
return env
671669

readthedocs/restapi/serializers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class ProjectAdminSerializer(ProjectSerializer):
4343
slug_field='feature_id',
4444
)
4545

46+
def get_environment_variables(self, obj):
47+
return {
48+
variable.name: variable.value
49+
for variable in obj.environmentvariable_set.all()
50+
}
51+
4652
class Meta(ProjectSerializer.Meta):
4753
fields = ProjectSerializer.Meta.fields + (
4854
'enable_epub_build',

0 commit comments

Comments
 (0)