testovaci data | pridan FlatPage /

This commit is contained in:
Bc. Petr Pecha 2015-06-02 22:37:25 +02:00
parent cb50f06840
commit e9db158327

View file

@ -7,6 +7,9 @@ from django.db import transaction
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni 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() User = django.contrib.auth.get_user_model()
@transaction.atomic @transaction.atomic
@ -15,6 +18,12 @@ def create_test_data(size = 6, rnd = None):
# pevna pseudo-nahodnost # pevna pseudo-nahodnost
rnd = rnd or random.Random(x=42) 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&iacute;tejte na str&aacute;nce semin&aacute;ře MaM!</p>")
f.sites.add(s[0])
f.save()
# users # users
admin = User.objects.create_superuser(username='admin', email='', password='admin') admin = User.objects.create_superuser(username='admin', email='', password='admin')