# Path: djwechat/wallpaper/models.py
# class Image(models.Model):
#     title = models.CharField(verbose_name=_('title'), max_length=25, db_index=True)
#     url = models.URLField(verbose_name=_('URL'), unique=True)
#     tags = models.ManyToManyField(Tag, verbose_name=_('Tags'))
#     publishedAt = models.DateField(verbose_name=_('Published Date'),
#                                    auto_now_add=True)
#     uuid = models.CharField(verbose_name=_('UUID'), max_length=32, unique=True)
#     show = models.BooleanField(verbose_name=_('Show'),
#                                help_text=_('Whether to show this image'),
#                                default=True)
# 
#     def __str__(self):
#         return self.title
# 
#     class Meta:
#         ordering = ['title']
#         verbose_name = _('Image')
#         verbose_name_plural = _('Images')


import os.path
import requests
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger
from django.core.paginator import Paginator
from django.http import JsonResponse
from django.shortcuts import get_list_or_404
from django.shortcuts import render
from .models import Image
# -*- coding: utf-8 -*-





# Create your views here.


def home(request):
    return render(request, 'wallpaper/index.html', {})


def next(request):
    keyword = request.POST.get('keyword', '')
    if not keyword:

# Path: djwechat/wallpaper/models.py
# class Image(models.Model):
#     title = models.CharField(verbose_name=_('title'), max_length=25, db_index=True)
#     url = models.URLField(verbose_name=_('URL'), unique=True)
#     tags = models.ManyToManyField(Tag, verbose_name=_('Tags'))
#     publishedAt = models.DateField(verbose_name=_('Published Date'),
#                                    auto_now_add=True)
#     uuid = models.CharField(verbose_name=_('UUID'), max_length=32, unique=True)
#     show = models.BooleanField(verbose_name=_('Show'),
#                                help_text=_('Whether to show this image'),
#                                default=True)
# 
#     def __str__(self):
#         return self.title
# 
#     class Meta:
#         ordering = ['title']
#         verbose_name = _('Image')
#         verbose_name_plural = _('Images')


# Path: djwechat/wallpaper/views.py
import os.path
import requests
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger
from django.core.paginator import Paginator
from django.http import JsonResponse
from django.shortcuts import get_list_or_404
from django.shortcuts import render
from .models import Image

# -*- coding: utf-8 -*-





# Create your views here.


def home(request):
    return render(request, 'wallpaper/index.html', {})


def next(request):
    keyword = request.POST.get('keyword', '')
    if not keyword:

        all_images = get_list_or_404(Image, show=True)