Skip to content

feat: add default avatar placeholder for profiles without picture#50

Merged
emidiovaleretto merged 1 commit into
mainfrom
feat/profile-picture-placeholder
Jun 14, 2026
Merged

feat: add default avatar placeholder for profiles without picture#50
emidiovaleretto merged 1 commit into
mainfrom
feat/profile-picture-placeholder

Conversation

@emidiovaleretto

@emidiovaleretto emidiovaleretto commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Context

UserProfile had no fallback when a user has no picture since the API returned
null. This completes issue #35 by serving a default avatar.

What

  • Add a picture_profile SerializerMethodField that returns the user's photo
    URL, or a static placeholder when none exists
  • Add static/images/placeholder.jpg as the default avatar
  • Configure STATICFILES_DIRS so the project's static folder is collected

Why

The placeholder is a static asset (served by WhiteNoise) rather than stored in
the DB or pulled from an external service — keeps the field empty when there's
no upload, and the default is decided at response time. Easy to swap later
without a migration.

How to verify

GET /api/auth/me/ for a user without a picture returns
picture_profile: "/static/images/placeholder.jpg". Tested via curl with JWT.

Closes #35

@emidiovaleretto emidiovaleretto self-assigned this Jun 14, 2026
@emidiovaleretto emidiovaleretto merged commit 207c9bc into main Jun 14, 2026
2 checks passed
@emidiovaleretto emidiovaleretto deleted the feat/profile-picture-placeholder branch June 14, 2026 22:04
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.

[FEATURE] Add profile picture to UserProfile with upload, normalisation and placeholder

1 participant