Repository navigation
Conversation
TutorCruncher2 is adding a "url" custom field type (shown as "Link"). Without this, socket rejects a tutor or lesson that has a Link value, and loading an enquiry form with a Link field raises KeyError. - ExtraAttributeModel.EATypeEnum accepts 'url'. - Enquiry form: a 'url' attribute renders as an <input type="url"> and is validated as an http/https URL with a TLD (pydantic.HttpUrl). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TutorCruncher2 reports a Link field as {type: url, required: False,
read_only: False, label, sort_index} with no max_length or help_text.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TutorCruncher reports a Stars custom field as type "decimal", which the enquiry form's type lookups didn't have, so a Stars field on the enquiry form raised KeyError on GET and POST. Show it as a whole-number input and check the value against the field's min, max and decimal places before queueing, then send it to TutorCruncher as a float. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ional box - Tutor profiles and lessons keep the link_text TutorCruncher sends for a Link field, so the widget can show it instead of the web address. It is stored only when sent, so other fields are stored as before. - An enquiry link longer than the max_length TutorCruncher reports (2048) is refused with a 400. Before, it was accepted, TutorCruncher refused it and the enquiry was lost. - A "" for an optional field (a box typed in then cleared) counts as not filled in, instead of failing the whole enquiry. Text and a dropdown with an empty option still send "". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The enquiry form sends "" for a box typed in then cleared. For an optional field this now counts as not filled in, instead of failing the whole enquiry with "value is not a valid decimal". Text and a dropdown with an empty option still send "". The same validator is in the Link PR (#563), byte for byte, so the two merge cleanly in either order. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pydantic's HttpUrl accepts links TutorCruncher refuses (an underscore in the host, an empty user, 999.1.1.1), and rewrites a non-ASCII host as punycode after the length check. socket answered 201, TutorCruncher refused the enquiry and it was lost. LinkUrl uses the patterns of Django's URLValidator, which TutorCruncher's LINK_URL_VALIDATOR is, and passes the value on unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The enquiry form now waits for TutorCruncher's answer: a refusal comes back as a 400 with TutorCruncher's errors, a bad reCAPTCHA as a 400, and an outage as a 502, instead of a 201 for an enquiry that was never saved. TutorCruncher now sends a link as a Short Textbox with link_text rather than a url type, so drop url from the profile and lesson types and keep a link out of the tutor's tag line. The enquiry form's url field type stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g the deploy still reach TutorCruncher Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in a text field as a link Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Stars custom fields on the enquiry form
decimalgoes to the widget asinteger, and the POST is checked withcondecimalfrom the field'smin_value/max_value/max_digits/decimal_places. It is sent on as a float.Optional fields
""for an optional field (a box typed in, then cleared) counts as not filled in. Text, and a dropdown with an empty option, still send"".The Link field work is removed: TutorCruncher no longer has a Link type or Show as Link (tutorcruncher/TutorCruncher2#18222 now shows every web address in a Short Textbox as a link on TC2 pages and sends Socket the plain value). Enquiries are still queued for the worker (
submit_enquiry) exactly as on master.Why
A Stars field with "Enquiry Form" ticked raised
KeyError: 'decimal'and broke that branch's whole enquiry form.How it was tested
test_enquiries.py: Stars valid, refused and empty values; empty optional and required fields.test_real_s3_testneeds real AWS keys and fails locally the same way without this change. flake8 passes.Deploy order
None: independent of tutorcruncher/TutorCruncher2#18222.
Demo
Local run of socket-frontend (tutorcruncher/socket-frontend#361) and socket-server (#563) with TutorCruncher: on the Socket enquiry form the Stars field refuses 7 and takes 4, a Date and Time field typed then cleared is sent as not filled in, the enquiry is accepted, and the new Client in TutorCruncher shows 4 stars. reCAPTCHA is stubbed locally. The clip is on TutorCruncher2's private
pr-screenshotsbranch, so it shows only to people with access to that repo.Full-quality video: https://github.com/tutorcruncher/TutorCruncher2/raw/pr-screenshots/feat_link_custom_field_type_socket/feat_link_custom_field_type_socket.webm
🤖 Generated with Claude Code