Skip to content

Commit

Permalink
fix: check for courseware object in cms (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
asadali145 authored May 3, 2024
1 parent 6dcdaa2 commit 4c79aea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ def __init__(self, data=None, files=None, parent_page=None, *args, **kwargs):

instance = kwargs.get("instance", None)
if instance and instance.id:
if instance.is_internal_or_external_course_page:
if instance.is_internal_or_external_course_page and instance.course:
course_runs = instance.course.courseruns.all()
course_run_choices = [("", "")] + [(run.id, run) for run in course_runs]
self.fields["course_run"].choices = course_run_choices

elif instance.is_internal_or_external_program_page:
elif instance.is_internal_or_external_program_page and instance.program:
self.fields["price"].initial = instance.program.current_price

def save(self, commit=True): # noqa: FBT002
Expand Down

0 comments on commit 4c79aea

Please sign in to comment.