Browse Source

testovaci data | pridan FlatPage /

remotes/origin/feincms
Bc. Petr Pecha 10 years ago
parent
commit
e9db158327
  1. 9
      seminar/testutils.py

9
seminar/testutils.py

@ -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&iacute;tejte na str&aacute;nce semin&aacute;ře MaM!</p>")
f.sites.add(s[0])
f.save()
# users
admin = User.objects.create_superuser(username='admin', email='', password='admin')

Loading…
Cancel
Save