-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added new and edit for organization #222
base: main
Are you sure you want to change the base?
Conversation
boxoffice/forms/org.py
Outdated
|
||
|
||
DEFAULT_ORG_DETAILS = { | ||
u'access_token': buid(), |
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.
This is declaring a fixed access token as a global.
boxoffice/forms/org.py
Outdated
|
||
class OrgForm(forms.Form): | ||
contact_email = forms.EmailField(__("Contact email"), | ||
validators=[forms.validators.DataRequired(__("Please enter an email address")), forms.validators.Length(min=5, max=80)]) |
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.
Use an email validator instead of a length validator.
boxoffice/forms/utils.py
Outdated
# so assign a default value of `{}` | ||
if not data or data == 'null': | ||
return json.dumps({}) | ||
return data |
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.
So it doesn't format JSON if the request is not a GET? That doesn't make sense.
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.
The formatting with indents is only to make it easy for the admin to edit it. simplejson
fails when the formatted version is supplied via populate_obj
.
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.
I mean the "return data" bit. It's returning the Python data object if the request is not a GET? Why?
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.
That's because json.dumps(data)
will result in a JSON string, which errors out when I attempt to store it in the database. Since it expects a dict, I just return the data
dict.
return render_message( | ||
title=_(u"No organizations available"), | ||
message=_(u"To setup Boxoffice for an organization, you must be the owner of the organization.")) | ||
|
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.
Use the logic used in Funnel's /new
handler. This code looks fragile.
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.
It's mostly borrowed from there. https://github.com/hasgeek/funnel/blob/master/funnel/views/profile.py#L34
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.
Damn, then that needs to be tossed as well. We can live with this for now, knowing that both places will need to be changed after hasgeek/lastuser#232.
|
No description provided.