Skip to content

Commit

Permalink
Fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternak committed Feb 17, 2020
1 parent 3d3a58d commit fb2b29b
Show file tree
Hide file tree
Showing 9 changed files with 393 additions and 212 deletions.
16 changes: 11 additions & 5 deletions src/bpp/management/commands/rebuild_cache.py
Expand Up @@ -4,21 +4,28 @@
from django.conf import settings
from django.core.management import BaseCommand

from bpp.models import Wydawnictwo_Zwarte, Wydawnictwo_Ciagle, rebuild_ciagle, rebuild_zwarte, Patent
from bpp.util import partition_count, no_threads

from bpp.models import (
Wydawnictwo_Ciagle,
Wydawnictwo_Zwarte,
rebuild_ciagle,
rebuild_zwarte,
)
from bpp.util import no_threads, partition_count


def subprocess_setup(*args):
from django.db import connection

connection.connect()


class Command(BaseCommand):
help = 'Odbudowuje cache'
help = "Odbudowuje cache"

def handle(self, *args, **options):
if not settings.TESTING:
from django import db

db.connections.close_all()

pool_size = no_threads(0.5)
Expand All @@ -29,4 +36,3 @@ def handle(self, *args, **options):

pc = pool.apply(partition_count, args=(Wydawnictwo_Zwarte.objects, pool_size))
pool.starmap(rebuild_zwarte, pc)

21 changes: 21 additions & 0 deletions src/bpp/migrations/0195_cc0.py
@@ -0,0 +1,21 @@
# Generated by Django 2.2.10 on 2020-02-17 21:34

from django.db import migrations


def forwards_func(apps, schema_editor):
Licencja_OpenAccess = apps.get_model("bpp", "Licencja_OpenAccess")
db_alias = schema_editor.connection.alias
Licencja_OpenAccess.objects.using(db_alias).get_or_create(
skrot="CC-ZERO",
nazwa="Creative Commons - Universal - Przekazanie do Domeny Publicznej (CC0 1.0)",
)


class Migration(migrations.Migration):

dependencies = [
("bpp", "0194_auto_20200213_2148"),
]

operations = [migrations.RunPython(forwards_func)]

0 comments on commit fb2b29b

Please sign in to comment.