DT
Size: a a a
DT
N
images/const/upload_sizes.py
images/utils.py
images/models.py
XM
urlpatterns = [
path('',views.index, name="home")
]
DT
urlpatterns = [
path('',views.index, name="home")
]
DT
N
DT
МП
N
DT
С
МП
week_delta = date.today() - timedelta(days=7)
newest = Article.objects.filter(source=OuterRef('pk')).order_by('-timestamp')
sources = DataSource.objects.annotate(
week_count=Count('articles', filter=Q(articles__timestamp__gte=week_delta)),
total_count=Count('articles'),
newest_article_time=Coalesce(Subquery(newest.values('timestamp')[:1]), date(1, 1, 1))
).order_by('-newest_article_time')
N
МП
🇦
R
se
Y