The new Awards admin page lets editors upload a custom display badge (emblem/logo shown as the award's anchor on the public Awards page), but unlike our other image uploads (People headshots, News thumbnails, Sponsor logos) it does not follow the standard admin pattern:
- no instant client-side preview of the selected file before saving, and
- no cropping control.
Fix
Apply the established ImageCroppingMixin + ImageRatioField (Cropper.js) pattern to Award.badge:
- New
Award.badge_cropping square (245x245) ImageRatioField — matches the Person/Sponsor portrait anchors so every award-row anchor (badge, portrait, project thumbnail, medal) reads as a uniform square tile.
AwardAdmin subclasses ImageCroppingMixin; badge_cropping added to the Display fieldset; new square "Badge" thumbnail column on the changelist.
- Public
display_award_snippet.html renders the badge through {% thumbnail ... box=award.badge_cropping crop %} so the crop is actually applied (was raw badge.url).
.award-anchor-badge CSS switched from contain/borderless to the shared square cover+border tile for uniformity.
- Regression tests pin the crop metadata + that the admin resolves the badge field to the Cropper.js widget.
Notes
- Square crop is intentional (uniform award row); editors re-crop on upload.
- Existing badges have a blank crop box until re-saved;
crop_corners treats blank as "no box" and center-crops, so nothing breaks in the meantime.
- New
badge_cropping column is created by the auto-makemigrations/migrate on container start (migrations are gitignored).
The new Awards admin page lets editors upload a custom display badge (emblem/logo shown as the award's anchor on the public Awards page), but unlike our other image uploads (People headshots, News thumbnails, Sponsor logos) it does not follow the standard admin pattern:
Fix
Apply the established
ImageCroppingMixin+ImageRatioField(Cropper.js) pattern toAward.badge:Award.badge_croppingsquare (245x245)ImageRatioField— matches the Person/Sponsor portrait anchors so every award-row anchor (badge, portrait, project thumbnail, medal) reads as a uniform square tile.AwardAdminsubclassesImageCroppingMixin;badge_croppingadded to the Display fieldset; new square "Badge" thumbnail column on the changelist.display_award_snippet.htmlrenders the badge through{% thumbnail ... box=award.badge_cropping crop %}so the crop is actually applied (was rawbadge.url)..award-anchor-badgeCSS switched fromcontain/borderless to the shared squarecover+border tile for uniformity.Notes
crop_cornerstreats blank as "no box" and center-crops, so nothing breaks in the meantime.badge_croppingcolumn is created by the auto-makemigrations/migrateon container start (migrations are gitignored).