Opened 4 weeks ago

Closed 3 weeks ago

#37277 closed Bug (duplicate)

Extending URLField to Support WebSocket Schemas (ws:// & wss://)

Reported by: sepehrnorouzi Owned by: sepehrnorouzi
Component: Core (Other) Version: 6.1
Severity: Normal Keywords: URLField, wss, websocket, validator
Cc: sepehrnorouzi Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi everyone,

I'd like to flag a blocker regarding our model fields—the current URLField validator rejects ws:// and wss:// schemas, which prevents us from storing WebSocket server endpoints.

I've already prepared a fix that adds the necessary schemes and includes the accompanying test suite. The branch is fully ready for peer review.

However, I'm running into a permissions blocker and cannot push the branch to our remote repository at the moment. Could someone please either grant me write access to the required branch or let me know the preferred way to submit this change?

Thanks in advance!

Attachments (1)

validators.py (21.9 KB ) - added by sepehrnorouzi 4 weeks ago.
I have the tests and the doc changes.

Download all attachments as: .zip

Change History (3)

by sepehrnorouzi, 4 weeks ago

Attachment: validators.py added

I have the tests and the doc changes.

comment:1 by sepehrnorouzi, 4 weeks ago

Cc: sepehrnorouzi added
Owner: set to sepehrnorouzi
Status: newassigned

comment:2 by David Smith, 3 weeks ago

Component: Core (URLs)Core (Other)
Easy pickings: unset
Resolution: duplicate
Status: assignedclosed
Summary: Update: Extending URLField to Support WebSocket Schemas (ws:// & wss://)Extending URLField to Support WebSocket Schemas (ws:// & wss://)

A similar request has been made a number of times, including #31063 and #26418. They were closed as changing the default schemes is backward incompatible.

You can use URLValidator to add schemes for your own needs. For example.

class MyURLField(models.URLField):
     default_validators = [URLValidator(schemes=["http", "https", "ws", "wss"])]
Note: See TracTickets for help on using tickets.
Back to Top