Skip to content

LanguageSerializer silently drops plural edits on PATCH/PUT #22077

Closed

Description

@nicommteam

Describe the issue

LanguageSerializer (weblate/api/serializers.py) defines a writable nested plural field, validated via LanguagePluralSerializer, but only overrides create() — there's no update() override. Language.plural is a @cached_property with no DB-backed setter, so DRF's default ModelSerializer.update() just assigns the dict into instance.__dict__["plural"] (shadowing the cached property) and calls instance.save(), which has no column to persist it to.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. PATCH /api/languages/<code>/ with a body containing updated plural data (e.g. a different formula or number).
  2. Response is 200 OK.
  3. Check the corresponding Plural row in the database — it is unchanged.

Expected behavior

Either the Plural row should be updated to match the submitted data, or the API should reject the write (e.g. make the field read-only on update) instead of silently accepting and discarding it.

Screenshots

No response

Exception traceback

How do you run Weblate?

Git checkout

Weblate version

2026.10.1.dev0 (git main, commit d4b0e61)

Weblate deploy checks

"N/A — this was found via code review of the main branch, not reproduced against a running deployment."

Additional context

Found while reviewing the API serializers for an unrelated contribution; happy to submit a PR adding the missing update() handling if that's the preferred fix.

Activity

  1. added
    Waiting for: TriageAssigned automatically for any new issue, needs attention from a Weblate member.
    on Oct 9, 2026
  2. Rahul-cs50 commented on Oct 21, 2026

    @Rahul-cs50

    @nicommteam are you still planning to send the PR you offered here? If you are, I'll leave it to you.

    Otherwise I have a fix ready that takes the first option from the issue: LanguageSerializer.update() writes the submitted values to the language's Plural row, a partial plural is validated against the stored number and formula, and changing the plural's source is rejected. It comes with API tests for PATCH. If I don't hear back, I'll open it tomorrow, unless a maintainer would rather make plural read-only on update.

  3. nijel commented on Oct 22, 2026

    @nijel
    Member

    This was really supposed to be only a create path. For the update, it might be ambiguous (the default plural might change between read and update, so the outcome might be other than desired). So I think the right approach would be to adjust OpenAPI schema, documentation and reject embedded plural on updates.

  4. added theissue type on Oct 22, 2026
  5. github-actions commented on Oct 22, 2026

    @github-actions

    This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.

    You can learn about how to get started in our contributors documentation.

  6. added this to the 2026.11 milestone on Oct 23, 2026
  7. added
    Waiting for: ImplementationAdded to a milestone, will be resolved according to the milestone timeline.
    and removed
    Waiting for: TriageAssigned automatically for any new issue, needs attention from a Weblate member.
    on Oct 23, 2026
  8. added a commit that references this issue on Oct 23, 2026
    cf9fd40
  9. added
    Waiting for: ReleaseThe issue is fixed and waiting to be released.
    and removed
    Waiting for: ImplementationAdded to a milestone, will be resolved according to the milestone timeline.
    on Oct 23, 2026
  10. github-actions commented on Oct 23, 2026

    @github-actions

    Thank you for your report — the issue has now been resolved.

    The fix has been merged into the repository and will be included in the upcoming Weblate 2026.11 release.

    • If you encounter any issues with the fix, please comment in this thread.
    • If you experience a similar but separate issue, open a new report so we can track it properly.
    • If you find Weblate helpful, consider supporting its development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIIssues related to API improvements.Waiting for: ReleaseThe issue is fixed and waiting to be released.good first issueOpportunity for newcoming contributors.

    Type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions