heartwood every commit a ring

Add recrawl button

4ff7d17e by Isaac Bythewood · 3 years ago

modified properties/templates/properties/property.html
@@ -51,10 +51,10 @@          {% endif %}          {% if user.is_authenticated %}          <a href="{% url 'property' property.id %}?report" target="_blank" class="btn btn-sm btn-primary ms-0 ms-lg-3 my-1">            Generate report            Report          </a>          <a href="{{ property.url }}?utm_source=status.bythewood.me" target="_blank" class="btn btn-sm btn-primary ms-0 ms-lg-3 my-1">            View site          <a href="{% url 'property' property.id %}?recrawl" class="btn btn-sm btn-primary ms-0 ms-lg-3 my-1">            Recrawl          </a>          {% endif %}          {% if not property.is_protected and user.is_authenticated %}
modified properties/views.py
@@ -12,6 +12,7 @@ from django.db import modelsfrom django.http import HttpResponse, JsonResponsefrom django.shortcuts import redirect, renderfrom django.template.loader import render_to_stringfrom django.utils import timezonefrom status.chromium import generate_pdf_from_html
@@ -103,6 +104,12 @@ def property(request, property_id):    if not property_obj.is_public and property_obj.user != request.user:        return redirect("properties")    if property_obj.user == request.user and request.GET.get('recrawl') == '':        property_obj.next_run_at_crawler = timezone.now()        property_obj.save()        messages.success(request, "This property will be recrawled shortly.")        return redirect("property", property_id=property_id)    # Set some basic page context variables    context["title"] = property_obj.name    context["description"] = "Status for " + property_obj.name