CollectionMember: add stokens when we create/change the member.
parent
91aadb6565
commit
1f18f4e50b
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-05-27 07:43
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('django_etesync', '0010_auto_20200526_1539'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='collectionmember',
|
||||||
|
name='stoken',
|
||||||
|
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='django_etesync.Stoken'),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-05-27 07:43
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def create_stokens(apps, schema_editor):
|
||||||
|
Stoken = apps.get_model('django_etesync', 'Stoken')
|
||||||
|
CollectionMember = apps.get_model('django_etesync', 'CollectionMember')
|
||||||
|
|
||||||
|
for member in CollectionMember.objects.all():
|
||||||
|
member.stoken = Stoken.objects.create()
|
||||||
|
member.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('django_etesync', '0011_collectionmember_stoken'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(create_stokens),
|
||||||
|
]
|
Loading…
Reference in New Issue