Files
offline-db/patch_user_profile.py
8d52f8c77a Add user bio field and validate profile updates (#322)
- Add `bio` (TextField) to `User` model.
- Extend `UserProfileAPIView` `patch` method to handle profile updates.
- Sanitize `bio` input using `bleach.clean` to prevent XSS.
- Validate `username` to allow only alphanumeric characters, underscores, and hyphens.
- Add comprehensive test cases in `test_profile_view.py`.
- Apply migrations.
- Mark relevant items as completed in `.jules/development-plan.md`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Senpai-YoloBot <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-22 12:25:48 +00:00

13 lines
331 B
Python

import re
with open('users/views.py', 'r') as f:
content = f.read()
new_content = content.replace(
"'is_premium': getattr(user, 'is_premium', False),",
"'is_premium': getattr(user, 'is_premium', False),\n 'bio': getattr(user, 'bio', ''),"
)
with open('users/views.py', 'w') as f:
f.write(new_content)