Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
820 B
27 lines
820 B
#!/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()
|
|
|