Пример #1
0
 def test_concat_coalesce_idempotent(self):
     pair = ConcatPair(V('a'), V('b'))
     # Check nodes counts
     self.assertEqual(len(list(pair.flatten())), 3)
     self.assertEqual(len(list(pair.coalesce().flatten())),
                      7)  # + 2 Coalesce + 2 Value()
     self.assertEqual(len(list(pair.flatten())), 3)
Пример #2
0
def backward(apps, schema_editor):
    for model in MODELS:
        ModelClass = apps.get_model('datamodel', model)

        ModelClass.objects.update(datum_begin_geldigheid=ConcatPair(
            Value('V'),
            ToChar(F('datum_begin_geldigheid_new'), Value('YYYYMMDD'))), )

        ModelClass.objects.exclude(datum_einde_geldigheid_new=None).update(
            datum_einde_geldigheid=ConcatPair(
                Value('V'),
                ToChar(F('datum_einde_geldigheid_new'), Value('YYYYMMDD'))), )

    ZaakType = apps.get_model('datamodel', 'ZaakType')
    ZaakType.objects.update(
        versiedatum=ToChar(F('versiedatum_new'), Value('YYYYMMDD')))
Пример #3
0
def backward(apps, schema_editor):
    for model in MODELS:
        ModelClass = apps.get_model("datamodel", model)

        ModelClass.objects.update(datum_begin_geldigheid=ConcatPair(
            Value("V"),
            ToChar(F("datum_begin_geldigheid_new"), Value("YYYYMMDD"))))

        ModelClass.objects.exclude(datum_einde_geldigheid_new=None).update(
            datum_einde_geldigheid=ConcatPair(
                Value("V"),
                ToChar(F("datum_einde_geldigheid_new"), Value("YYYYMMDD"))))

    ZaakType = apps.get_model("datamodel", "ZaakType")
    ZaakType.objects.update(
        versiedatum=ToChar(F("versiedatum_new"), Value("YYYYMMDD")))
Пример #4
0
 def get_queryset(self):
     qs = super().get_queryset()
     qs = qs.annotate(
         concept_name=ConcatPair('concepto__padre__nombre', 'concepto__nombre', 'concepto__medida__nombre'))
     form = AdquisicionesForm(data=self.request.GET)
     if form.is_valid():
         qs = filter_query(form, qs, self.internal_filters)
         return qs
     return self.model.objects.none()
Пример #5
0
 def test_concat_coalesce_idempotent(self):
     pair = ConcatPair(V('a'), V('b'))
     # Check nodes counts
     self.assertEqual(len(list(pair.flatten())), 3)
     self.assertEqual(len(list(pair.coalesce().flatten())), 7)  # + 2 Coalesce + 2 Value()
     self.assertEqual(len(list(pair.flatten())), 3)