Files @ 2cdb554623e5
Branch filter:

Location: symposion_app/pinaxcon/monkey_patch.py

Christopher Neugebauer
Tuesday & Wednesday work (#30)

* Fixes an incorrect link in dashboard

* Disables the symposion sponsors app

* Adds redirect links for login/logout; adds THEME_CONTACT_EMAIL value

* Re-adds colophon/copyright message.

* Adds AceMarkdownEditor widget

* Tidies up the generated HTML

* Tidies up form snippet behaviour

* Proposals forms now use the markdown editor

* Monkey patches the markdown editor into the speaker form.

* Adds missing field to proposal details

* Fixes #10 — adds a link to random unreviewed proposals

* Minor tweaks
class MonkeyPatchMiddleware(object):
    ''' Ensures that our monkey patching only gets called after it is safe to do so.'''

    def process_request(self, request):
        do_monkey_patch()


def do_monkey_patch():
    patch_speaker_profile_form()

    # Remove this function from existence
    global do_monkey_patch
    do_monkey_patch = lambda: None


def patch_speaker_profile_form():
    ''' Replaces textarea widgets with markdown editors. '''
    
    import widgets
    from symposion.speakers.forms import SpeakerForm

    fields = SpeakerForm.base_fields
    fields["biography"].widget = widgets.AceMarkdownEditor()
    fields["experience"].widget = widgets.AceMarkdownEditor()
    fields["accessibility"].widget = widgets.AceMarkdownEditor()