allow to run feed task from interface
This commit is contained in:
parent
71d7ea7147
commit
f52621a267
@ -34,7 +34,10 @@
|
||||
{% bootstrap_form config_form layout='horizontal' %}
|
||||
</div>
|
||||
<footer class="card-footer text-right">
|
||||
{% if feed %}<a href="#delete-modal" class="modal-basic btn btn-danger">Delete</a>{% endif %}
|
||||
{% if feed %}
|
||||
<a href="#delete-modal" class="modal-basic btn btn-danger">Delete</a>
|
||||
<button type="submit" name="run" class="btn btn-secondary">Run now</button>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</footer>
|
||||
</form>
|
||||
|
@ -10,6 +10,7 @@ from django.views.generic.detail import SingleObjectMixin
|
||||
from cabinet.utils import CabinetViewMixin
|
||||
from feeds.models import Feed
|
||||
from feeds.modules import *
|
||||
from feeds.tasks import execute_feed
|
||||
from feeds.utils import BaseFeedConfigView
|
||||
|
||||
|
||||
@ -32,9 +33,12 @@ class FeedConfigEditView(BaseFeedConfigView, SingleObjectMixin):
|
||||
sidebar_section = 'feeds'
|
||||
|
||||
def form_valid(self, feed_form, config_form):
|
||||
feed_form.save()
|
||||
feed = feed_form.save()
|
||||
config_form.save()
|
||||
messages.success(self.request, 'Config was successfully saved')
|
||||
if 'run' in self.request.POST:
|
||||
execute_feed.apply_async(args=(feed.pk,), shadow=str(feed))
|
||||
else:
|
||||
messages.success(self.request, 'Config was successfully saved')
|
||||
return HttpResponseRedirect('')
|
||||
|
||||
def get_content_type(self):
|
||||
|
Loading…
Reference in New Issue
Block a user