Beispiel #1
0
 def post(self, request, *args, **kwargs):
     version = self.get_object()
     if not version.active:
         version.built = False
         version.save()
         log.info('Removing files for version.', version_slug=version.slug)
         clean_project_resources(
             version.project,
             version,
         )
     else:
         return HttpResponseBadRequest(
             "Can't delete HTML for an active version.", )
     return HttpResponseRedirect(self.get_success_url())
Beispiel #2
0
 def form_valid(self, form):
     version = form.save()
     if form.has_changed():
         if 'active' in form.changed_data and version.active is False:
             log.info(
                 'Removing files for version.',
                 version_slug=version.slug,
             )
             clean_project_resources(
                 version.project,
                 version,
             )
             version.built = False
             version.save()
     return HttpResponseRedirect(self.get_success_url())
Beispiel #3
0
 def delete(self, *args, **kwargs):  # pylint: disable=arguments-differ
     from readthedocs.projects.tasks.utils import clean_project_resources
     log.info('Removing files for version.', version_slug=self.slug)
     clean_project_resources(self.project, self)
     super().delete(*args, **kwargs)