Skip to content

Conversation

edwoodward
Copy link
Contributor

JSON returned from apps/cms/api/snippets/givebanner/

[
    {
        "html_message": "Help students around the world succeed with <strong>contributions of $5, $10 or $20</strong>",
        "link_text": "Make a difference now",
        "link_url": "https://openstax.org/give",
        "banner_thumbnail": "/media/original_images/subj-icon-calculator.png"
    }
]

@edwoodward edwoodward self-assigned this Mar 14, 2022
@edwoodward edwoodward requested a review from mwvolo March 14, 2022 20:37


class GiveBannerViewSet(viewsets.ModelViewSet):
queryset = GiveBanner.objects.all()
Copy link
Member

Choose a reason for hiding this comment

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

do you want to make sure only one is returned here?
queryset = GiveBanner.objects.first()

Copy link
Member

Choose a reason for hiding this comment

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

or all()[0]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a validation so only one banner is created. Tests were failing if there was not a GiveBanner created using the list

@edwoodward edwoodward merged commit 7ce0527 into main Mar 16, 2022
@edwoodward edwoodward deleted the give-banner branch March 16, 2022 11:59
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