Repository: fossasia/open-event-server

Issue:
Wizard step 1 name: Organizer showing up even though field is deactivated
Organizer field was activated and then deactivated in wizard step 1. Expected behaviour is that the info and organizer link in the event page does not show up anymore, but it still does.

Compare: https://open-event-dev.herokuapp.com/e/85/

![screenshot from 2016-07-19 16 47 04](https://cloud.githubusercontent.com/assets/1583873/16954311/b48ebdc6-4dd0-11e6-92d5-c4fed2c39d70.png)



Discussion:
I will check this our asap.


Resolving patch:
diff --git a/app/helpers/data.py b/app/helpers/data.py
--- a/app/helpers/data.py
+++ b/app/helpers/data.py
@@ -836,10 +836,7 @@ def create_event(form, img_files):
                       sub_topic=form['sub_topic'],
                       privacy=form.get('privacy', u'public'),
                       ticket_url=form['ticket_url'],
-                      organizer_name=form['organizer_name'],
-                      organizer_description=form['organizer_description'],
                       copyright=copyright,
-                      code_of_conduct=form['code_of_conduct'],
                       show_map=1 if form.get('show_map') == "on" else 0,
                       creator=login.current_user)
 
@@ -852,6 +849,13 @@ def create_event(form, img_files):
                     if addr['types'] == ['locality', 'political']:
                         event.searchable_location_name = addr['short_name']
 
+        if form.get('organizer_state', u'off') == u'on':
+            event.organizer_name = form['organizer_name']
+            event.organizer_description = form['organizer_description']
+
+        if form.get('coc_state', u'off') == u'on':
+            event.code_of_conduct = form['code_of_conduct']
+
         state = form.get('state', None)
         print state
         if state and ((state == u'Published' and not string_empty(
@@ -1068,9 +1072,6 @@ def edit_event(request, event_id, event, session_types, tracks, social_links, mi
         event.show_map = 1 if form.get('show_map') == "on" else 0
         event.sub_topic = form['sub_topic']
         event.privacy = form.get('privacy', 'public')
-        event.organizer_name = form['organizer_name']
-        event.organizer_description = form['organizer_description']
-        event.code_of_conduct = form['code_of_conduct']
         event.ticket_url = form['ticket_url']
 
         if event.latitude and event.longitude:
@@ -1082,6 +1083,18 @@ def edit_event(request, event_id, event, session_types, tracks, social_links, mi
                     if addr['types'] == ['locality', 'political']:
                         event.searchable_location_name = addr['short_name']
 
+        if form.get('organizer_state', u'off') == u'on':
+            event.organizer_name = form['organizer_name']
+            event.organizer_description = form['organizer_description']
+        else:
+            event.organizer_name = ""
+            event.organizer_description = ""
+
+        if form.get('coc_state', u'off') == u'on':
+            event.code_of_conduct = form['code_of_conduct']
+        else:
+            event.code_of_conduct = ""
+
         if not event.copyright:
             # It is possible that the copyright is set as None before.
             # Set it as an `EventCopyright` object.
@@ -1271,7 +1284,6 @@ def edit_event(request, event_id, event, session_types, tracks, social_links, mi
             CustomForms, event_id=event.id,
             session_form=session_form, speaker_form=speaker_form)
 
-
         if form.get('call_for_speakers_state', u'off') == u'on':
             if call_for_papers:
                 call_for_papers.announcement = form['announcement']


Test patch: