Adds custom clean and view logic for enforcing only one cover story#2
Adds custom clean and view logic for enforcing only one cover story#2
Conversation
|
The message I would actually send, for brevity: My actual code critiques:
|
…cms_user_sees_edit_link
| """ Return the real divesite source name for the newspost's source | ||
| """ | ||
| source_dive = 'Industry Dive' | ||
| for dive_source in DIVESITE_SOURCE_NAMES: |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| if n.is_cover_story == True: | ||
| if n != self.instance: | ||
| n.is_cover_story = False | ||
| n.save() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Acceptance Summary (1/4):❌ AC1. The newspost designated as the cover story should appear in the cover story box |
| cover_story = None | ||
| top_stories = [] | ||
| other_stories = [] | ||
| newsposts = NewsPost.objects.all().order_by('publish_date') |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| for n in newsposts: | ||
| if n.is_cover_story == True: | ||
| cover_story = n | ||
| if i < 3: |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| i = 1 | ||
| for n in newsposts: | ||
| if n.is_cover_story == True: | ||
| cover_story = n | ||
| if i < 3: | ||
| top_stories.append(n) | ||
| i = i + 1 | ||
| else: | ||
| other_stories.append(n) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Food for thoughtAlthough the Newspost teasers is rendered without issues. We should consider parsing the body and picking out pure text for the teaser text. Further we can strip this for whitespace. One option is to modify the teaser property However considering the overhead, we might want to do this on save in the admin side and save the teaser as a pre calculated field. |
Business requirements
Technical context
Manual testing