mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2025-02-16 21:38:33 +00:00
fix static html num_outputs info
This commit is contained in:
parent
fde65c3b7d
commit
7fdea91311
2 changed files with 14 additions and 7 deletions
|
@ -135,12 +135,15 @@ class AddView(UserPassesTestMixin, FormView):
|
|||
def test_func(self):
|
||||
return PUBLIC_ADD_VIEW or self.request.user.is_authenticated
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super().get_context_data(*args, **kwargs)
|
||||
context["title"] = "Add URLs"
|
||||
# We can't just call request.build_absolute_uri in the template, because it would include query parameters
|
||||
context["absolute_add_path"] = self.request.build_absolute_uri(self.request.path)
|
||||
return context
|
||||
def get_context_data(self, **kwargs):
|
||||
return {
|
||||
**super().get_context_data(**kwargs),
|
||||
'title': "Add URLs",
|
||||
# We can't just call request.build_absolute_uri in the template, because it would include query parameters
|
||||
'absolute_add_path': self.request.build_absolute_uri(self.request.path),
|
||||
'VERSION': VERSION,
|
||||
'FOOTER_INFO': FOOTER_INFO,
|
||||
}
|
||||
|
||||
def form_valid(self, form):
|
||||
url = form.cleaned_data["url"]
|
||||
|
|
|
@ -207,6 +207,10 @@ class Link:
|
|||
})
|
||||
return info
|
||||
|
||||
def as_snapshot(self):
|
||||
from core.models import Snapshot
|
||||
return Snapshot.objects.get(url=self.url)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_info, guess=False):
|
||||
from ..util import parse_date
|
||||
|
@ -339,7 +343,7 @@ class Link:
|
|||
### Archive Status Helpers
|
||||
@property
|
||||
def num_outputs(self) -> int:
|
||||
return len(tuple(filter(None, self.latest_outputs().values())))
|
||||
return self.as_snapshot().num_outputs
|
||||
|
||||
@property
|
||||
def num_failures(self) -> int:
|
||||
|
|
Loading…
Add table
Reference in a new issue