-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotel Lottery Forms #4360
base: main
Are you sure you want to change the base?
Hotel Lottery Forms #4360
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One requested change and some questions!
@@ -255,6 +255,7 @@ def returns_json(*args, **kwargs): | |||
assert cherrypy.request.method == 'POST', 'POST required, got {}'.format(cherrypy.request.method) | |||
check_csrf(kwargs.pop('csrf_token', None)) | |||
except Exception: | |||
traceback.print_exc() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check, is/was this a temporary statement for debugging?
@@ -28,6 +29,10 @@ def valid_cellphone(form, field): | |||
'include a country code (e.g. +44) for international numbers.') | |||
|
|||
|
|||
class LotteryApplication(MagForm): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this into its own forms/hotel.py file, to more closely reflect where it is in models/. I'm sure we'll have plenty of lottery-related forms as we progress so it won't be a file with just one class in it.
Also, just wondering, why is this a StringField and not a SelectMultipleField or similar? Is it because the choices have to be ordered?
|
||
|
||
class HotelLotteryApplication(MagForm): | ||
ranked_hotels = Ranking(c.HOTEL_LOTTERY.keys()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Ranking() a widget or a field class? I see this form isn't being used, is it just left over from something else you were trying?
@@ -102,3 +102,59 @@ def render_option(cls, value, label, selected, **kwargs): | |||
return Markup( | |||
"<option {}>{}</option>".format(html_params(**options), escape(label)) | |||
) | |||
|
|||
class Ranking(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check, should this be subclassing an existing WTForms widget?
A very rough start at adding the necessary forms for a hotel lottery.