fix: add is_configured property
This commit is contained in:
committed by
Mehak Nasir
parent
770230c366
commit
51b2b89bcd
@@ -552,17 +552,13 @@ class ProgramDiscussionsConfiguration(TimeStampedModel):
|
||||
return f"Configuration(uuid='{self.program_uuid}', provider='{self.provider_type}', enabled={self.enabled})"
|
||||
|
||||
@classmethod
|
||||
def is_enabled(cls, program_uuid) -> bool:
|
||||
def get(cls, program_uuid):
|
||||
"""
|
||||
Check if there is an active configuration for a given program uuid
|
||||
|
||||
Default to False, if no configuration exists
|
||||
Lookup a program discussion configuration by program uuid.
|
||||
"""
|
||||
try:
|
||||
configuration = cls.objects.get(program_uuid=program_uuid)
|
||||
return configuration.enabled
|
||||
except cls.DoesNotExist:
|
||||
return False
|
||||
return ProgramDiscussionsConfiguration.objects.filter(
|
||||
program_uuid=program_uuid
|
||||
).first()
|
||||
|
||||
|
||||
class DiscussionTopicLink(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user