-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Promote the YAML config on project import #5444
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ | |
ProjectAdvancedForm, | ||
ProjectAdvertisingForm, | ||
ProjectBasicsForm, | ||
ProjectExtraForm, | ||
ProjectRelationshipForm, | ||
RedirectForm, | ||
TranslationForm, | ||
|
@@ -255,16 +254,11 @@ class ImportWizardView(ProjectSpamMixin, PrivateViewMixin, SessionWizardView): | |
|
||
form_list = [ | ||
('basics', ProjectBasicsForm), | ||
('extra', ProjectExtraForm), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we ending up with only one form in this list, we may remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The corporate code actually relies on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not refactor the corporate code for this as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to make the scope of the change smaller rather than larger. |
||
] | ||
condition_dict = {'extra': lambda self: self.is_advanced()} | ||
|
||
def get_form_kwargs(self, step=None): | ||
"""Get args to pass into form instantiation.""" | ||
kwargs = {} | ||
kwargs['user'] = self.request.user | ||
if step == 'basics': | ||
kwargs['show_advanced'] = True | ||
kwargs = {'user': self.request.user} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
return kwargs | ||
|
||
def get_template_names(self): | ||
|
@@ -280,7 +274,6 @@ def done(self, form_list, **kwargs): | |
finish by added the members to the project and saving. | ||
""" | ||
form_data = self.get_all_cleaned_data() | ||
extra_fields = ProjectExtraForm.Meta.fields | ||
# expect the first form; manually wrap in a list in case it's a | ||
# View Object, as it is in Python 3. | ||
basics_form = list(form_list)[0] | ||
|
@@ -290,9 +283,6 @@ def done(self, form_list, **kwargs): | |
tags = form_data.pop('tags', []) | ||
for tag in tags: | ||
project.tags.add(tag) | ||
for field, value in list(form_data.items()): | ||
if field in extra_fields: | ||
setattr(project, field, value) | ||
project.save() | ||
|
||
# TODO: this signal could be removed, or used for sync task | ||
|
@@ -316,11 +306,6 @@ def trigger_initial_build(self, project): | |
async_result = task_promise.apply_async() | ||
return async_result | ||
|
||
def is_advanced(self): | ||
"""Determine if the user selected the `show advanced` field.""" | ||
data = self.get_cleaned_data_for_step('basics') or {} | ||
return data.get('advanced', True) | ||
|
||
|
||
class ImportDemoView(PrivateViewMixin, View): | ||
|
||
|
This file was deleted.
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.
Instead of the above line saying,
what about saying something like "Here is a minimum example configuration file:" or some better phrase than that one but making it clear that it's the minimum inviting the user to copy and paste as is other than keep reading the whole page.
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 think there's a few changes so that the YAML docs are better "at a glance". I think that should be a separate PR but I can take care of this small change here.