mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-15 15:44:26 -04: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):
|
def test_func(self):
|
||||||
return PUBLIC_ADD_VIEW or self.request.user.is_authenticated
|
return PUBLIC_ADD_VIEW or self.request.user.is_authenticated
|
||||||
|
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(*args, **kwargs)
|
return {
|
||||||
context["title"] = "Add URLs"
|
**super().get_context_data(**kwargs),
|
||||||
# We can't just call request.build_absolute_uri in the template, because it would include query parameters
|
'title': "Add URLs",
|
||||||
context["absolute_add_path"] = self.request.build_absolute_uri(self.request.path)
|
# We can't just call request.build_absolute_uri in the template, because it would include query parameters
|
||||||
return context
|
'absolute_add_path': self.request.build_absolute_uri(self.request.path),
|
||||||
|
'VERSION': VERSION,
|
||||||
|
'FOOTER_INFO': FOOTER_INFO,
|
||||||
|
}
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
url = form.cleaned_data["url"]
|
url = form.cleaned_data["url"]
|
||||||
|
|
|
@ -207,6 +207,10 @@ class Link:
|
||||||
})
|
})
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
def as_snapshot(self):
|
||||||
|
from core.models import Snapshot
|
||||||
|
return Snapshot.objects.get(url=self.url)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, json_info, guess=False):
|
def from_json(cls, json_info, guess=False):
|
||||||
from ..util import parse_date
|
from ..util import parse_date
|
||||||
|
@ -339,7 +343,7 @@ class Link:
|
||||||
### Archive Status Helpers
|
### Archive Status Helpers
|
||||||
@property
|
@property
|
||||||
def num_outputs(self) -> int:
|
def num_outputs(self) -> int:
|
||||||
return len(tuple(filter(None, self.latest_outputs().values())))
|
return self.as_snapshot().num_outputs
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def num_failures(self) -> int:
|
def num_failures(self) -> int:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue