mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
a01c9e2303
This field is a boolean indicating if the article can be purshased by nonmembers.
28 lines
919 B
Python
28 lines
919 B
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.11.29 on 2020-09-25 16:45
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('cotisations', '0046_article_need_membership'),
|
|
]
|
|
|
|
def init_need_membership(apps, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
article = apps.get_model("cotisations", "Article")
|
|
articles = article.objects.using(db_alias).all()
|
|
for art in articles:
|
|
v = False
|
|
v = v or bool(art.duration_membership)
|
|
v = v or bool(art.duration_days_membership)
|
|
v = v or not (bool(art.duration_connection) or bool(art.duration_days_connection))
|
|
art.need_membership = v
|
|
art.save()
|
|
|
|
operations = [
|
|
migrations.RunPython(init_need_membership, lambda *args, **kargs: None),
|
|
]
|