get image(): string {
return this.imageUrl
? `https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y`
: 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y';
{% block content %}{% endblock %}
class ArticlesListView(ListView):
model = Article
paginate_by = 45
context_object_name = 'articles'
def get_queryset(self, **kwargs):
return Article.objects.get_published()
class NewListView(ArticlesListView):
def get(self, request, *args, **kwargs):
if self.request.GET.get('mode'):
articles = Article.objects.get_recent()
template = get_template('articles/article_list.html')
result = template.render({'articles': articles})
return HttpResponse(json.dumps({
'template': result
}), content_type='application/json; charset=utf8', status=200)
return super().get(request, *args, **kwargs)
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['article_source'] = ARTICLE_SOURCES['recent']
return context
def get_queryset(self):
return super().get_queryset().get_recent()
http:// site.com/
http:// site.com/books
http:// site.com/albums
http:// site.com/?template=1
http:// site.com/books/?template=1
http:// site.com/albums/?template=1
Это понятно что в сторе записать
Я про другое спросил