Pavel Turinsky (DebianVM @ Zr)
3 years ago
2 changed files with 30 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||
Tahle slozka obsahuje vsechny detaily a popisy, jak nasadit "druhou verzi" M&M webu. |
|||
|
|||
TODO: chybi tu popis na zprovozneni flatpages, na loaddata &c. |
@ -0,0 +1,27 @@ |
|||
#!/usr/bin/env python3 |
|||
|
|||
import os |
|||
import sys |
|||
|
|||
import django |
|||
|
|||
#### Inicializace Djanga |
|||
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/..') |
|||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mamweb.settings') |
|||
django.setup() |
|||
|
|||
## Pozor, nejde pouzit ORM, protoze kod je na jine verzi nez databaze a nejde namigrovat. |
|||
from django.db import connection |
|||
|
|||
|
|||
def smaz_zle_clanky(): |
|||
# Tyhle clanky vubec nejsou clanky, bude potreba je udelat cele jinak a spravne. |
|||
#m.Problem.objects.filter(id__in=[1981, 1970, 2222]).delete() |
|||
with connection.cursor() as cursor: |
|||
# Nejdriv musime smazat reseni: |
|||
cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);') |
|||
# Nakonec i ty clanky samotne |
|||
cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);') |
|||
|
|||
|
|||
smaz_zle_clanky() |
Loading…
Reference in new issue