Resolve `django_form` limitations
Một pull request liên quan đã được merge.
- #298 của @Archmonger — đã merge
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python, react
- Lĩnh vực
- full-stack
Hướng nghiên cứu
Start by reading the client code under src/js/src and the server websocket entry point in src/reactpy_django/websocket/consumer.py, then review the related draft PR #859 and the merged work in #298. Done means the unresolved FileField and ImageField limitations and form restoration on page reload have defined, working behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Current Situation and Proposed Actions
Serializable data fields do not work (Unresolved)
The following fields are currently incompatible with django_form due to ReactPy's client and server not supporting file serialization:
-
FileField -
ImageField
My two initial ideas on how to solve this:
- Extend the current implementation but use a custom messaging schema
- Specifically, adding some sort of messaging websocket schema that can differentiate between layout messages and file transfers.
- On the server-side, we could consider re-using Django's UploadHandler.
- The UploadHandler will probably need to be subclassed to get things working with ReactPy.
- Determine how to pipe the HTTP client/server stack through a websocket
- This would be convenient - specifically would enable us to retain the exact same upload behavior that users would expect on any specific Django version
It might be difficult to figure out what to do on early websocket termination. It might also make sense to create a throttling system where the server can control the incoming upload speed.
There was a related draft PR for file uploads that could be leveraged for inspiration.
Multiple choice fields do not work (Fixed in #298)
There is an additional set of fields that are currently incompatible with django_form, and this seems to be caused by weirdness with how Django re-hydrates/re-renders the form submission data:
-
SplitDateTimeField -
MultiValueField
When the form data is submitted, those fields don't properly rehydrate themselves when given form submission data. This causes incorrect re-renders.
This might just be a limitation of our current rendering methodology. If that is true, then fixing this will require digging into Django's form rendering stack and figuring out why they don't rehydrate properly when given the expected values.
Form restoration on page load (Unresolved)
The following limitation will also need to be resolved:
- Implement form restoration on page reload.
- Perhaps pre-rendering plus the browser's default behavior may already handle form restoration well enough? Probably not, but this should be investigated.
- Maybe this involves creating a new setting called
form_restoration_methodthat can be set to"URL","CLIENT_LOCAL_STORAGE","SERVER_SESSION", orNone. Note that "URL" mode would likely limit the user to one form per page. - Maybe we need to mandate the user provides a
keyfor the form if using form restoration in order to properly re-hydrate the form? Or perhaps we can use the form's CSRF token as the key? Or perhaps it can be linked directly to the browser'sscope["session"]? This needs some additional thought.
- Ngôn ngữ chính
- Python
- Star
- 357
- Fork
- 22
- Merge trung bình
- 10 giờ 31 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của reactive-python/reactpy-django
-
Add coverage tests Đang mởcomplexity: 3 (low) priority: 3 (low) type: ci
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
complexity: 2 (medium) priority: 3 (low)
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
complexity: 2 (medium) priority: 3 (low)
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
`pyscript_router` component Đang mởcomplexity: 1 (high) priority: 2 (moderate)
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
complexity: 2 (medium) priority: 2 (moderate) type: investigation
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
Tất cả issue của reactive-python/reactpy-django
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·