Skip to content

Conversation

mubbsharanwar
Copy link
Contributor

Description

Refactor enable_certificate_generation to class-based EnableCertificateGenerationAPIView.

@mubbsharanwar mubbsharanwar force-pushed the convert-enable_certificate_generation-drf branch 4 times, most recently from 55c1b28 to 433e582 Compare September 4, 2025 13:58
@mubbsharanwar mubbsharanwar force-pushed the convert-enable_certificate_generation-drf branch 3 times, most recently from 15b3a29 to 4f548f4 Compare September 8, 2025 06:14
Comment on lines +483 to +487
certificates_enabled = serializers.BooleanField(
required=False,
default=False,
help_text="Enable or disable self-generated certificates for this course."
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we removed source?
After that we wouldn't need this probably.

data = {
    "certificates_enabled": request.data.get("certificates-enabled", False)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added it initially to map certificates-enabled to certificates_enabled in the serializer, but that didn't work(the serializer was not making it a boolean and also not converting to snake case), so we prepared a data dict to pass it. We also have code reference for this approach.

Refactor enable_certificate_generation to class based EnableCertificateGenerationAPIView
@mubbsharanwar mubbsharanwar force-pushed the convert-enable_certificate_generation-drf branch from 4f548f4 to 7b774d3 Compare September 10, 2025 05:15
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

Successfully merging this pull request may close these issues.

2 participants