testovaci data | pridan FlatPage /
This commit is contained in:
parent
cb50f06840
commit
e9db158327
1 changed files with 9 additions and 0 deletions
|
@ -7,6 +7,9 @@ from django.db import transaction
|
|||
|
||||
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni
|
||||
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
User = django.contrib.auth.get_user_model()
|
||||
|
||||
@transaction.atomic
|
||||
|
@ -15,6 +18,12 @@ def create_test_data(size = 6, rnd = None):
|
|||
# pevna pseudo-nahodnost
|
||||
rnd = rnd or random.Random(x=42)
|
||||
|
||||
# static URL stranky
|
||||
s = Site.objects.filter(name="example.com")
|
||||
f = FlatPage.objects.create(url="/", title="Seminář M&M", content = "<p>Vítejte na stránce semináře MaM!</p>")
|
||||
f.sites.add(s[0])
|
||||
f.save()
|
||||
|
||||
# users
|
||||
admin = User.objects.create_superuser(username='admin', email='', password='admin')
|
||||
|
||||
|
|
Loading…
Reference in a new issue