This repository has been archived by the owner on Jun 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API URL config option for Wikipedia app.
- Loading branch information
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
from go.conversation.view_definition import ConversationViewDefinitionBase | ||
from django import forms | ||
|
||
from go.conversation.view_definition import ( | ||
ConversationViewDefinitionBase, EditConversationView) | ||
|
||
|
||
class ConfigForm(forms.Form): | ||
api_url = forms.CharField( | ||
help_text='The mediawiki API URL to use.', required=False) | ||
|
||
@staticmethod | ||
def initial_from_config(data): | ||
return { | ||
'api_url': data.get('api_url', None), | ||
} | ||
|
||
def to_config(self): | ||
data = self.cleaned_data | ||
config_dict = {} | ||
if data['api_url']: | ||
config_dict['api_url'] = data['api_url'] | ||
return config_dict | ||
|
||
|
||
class EditWikipediaView(EditConversationView): | ||
edit_forms = ( | ||
(None, ConfigForm), | ||
) | ||
|
||
|
||
class ConversationViewDefinition(ConversationViewDefinitionBase): | ||
pass | ||
edit_view = EditWikipediaView |