|
|
@ -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') |
|
|
|
|
|
|
|