Compare commits
2 Commits
4a7939adfb
...
892ae58b9a
Author | SHA1 | Date |
---|---|---|
ClF3 | 892ae58b9a | |
ClF3 | 70fafd3ed6 |
|
@ -5,7 +5,7 @@ class Picture(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
author = models.CharField(max_length=100)
|
author = models.CharField(max_length=100)
|
||||||
|
author_url=models.URLField()
|
||||||
original_url = models.URLField()
|
original_url = models.URLField()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.name
|
|
@ -1,5 +1,8 @@
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
|
from .models import Picture
|
||||||
|
|
||||||
|
pics=Picture.objects.order_by("?")
|
||||||
|
|
||||||
def get_random_picture():
|
def get_random_picture():
|
||||||
with open("./jsons/pics.json") as f:
|
with open("./jsons/pics.json") as f:
|
||||||
|
|
|
@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'randpic.apps.RandpicConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
|
Loading…
Reference in New Issue