parent
652a6dff32
commit
d23bb074b6
|
@ -0,0 +1,25 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wcs', '0047_careforms_title'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='wcscardinfoscell',
|
||||
name='limit',
|
||||
field=models.PositiveSmallIntegerField(
|
||||
blank=True, null=True, verbose_name='Number of cards per page (default 10)'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='wcscardinfoscell',
|
||||
name='only_for_user',
|
||||
field=models.BooleanField(
|
||||
default=False, verbose_name='Limit to cards linked to the logged-in user'
|
||||
),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,24 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
def update_only_for_user(apps, schema_editor):
|
||||
WcsCardInfosCell = apps.get_model('wcs', 'WcsCardInfosCell')
|
||||
for cell in WcsCardInfosCell.objects.all():
|
||||
if not cell.carddef_reference:
|
||||
continue
|
||||
parts = cell.carddef_reference.split(':')
|
||||
if len(parts) <= 2:
|
||||
continue
|
||||
cell.only_for_user = True
|
||||
cell.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wcs', '0048_card_pagination'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_only_for_user, migrations.RunPython.noop),
|
||||
]
|
|
@ -945,7 +945,11 @@ class WcsCardInfosCell(CardMixin, CellBase):
|
|||
carddef_reference = models.CharField(_('Card Model'), max_length=150)
|
||||
related_card_path = models.CharField(_('Card Identifier'), max_length=1000, blank=True)
|
||||
card_ids = models.CharField(_('Other Card Identifiers'), max_length=1000, blank=True)
|
||||
only_for_user = models.BooleanField(_('Limit to cards linked to the logged-in user'), default=False)
|
||||
without_user = models.BooleanField(_('Ignore the logged-in user'), default=False)
|
||||
limit = models.PositiveSmallIntegerField(
|
||||
_('Number of cards per page (default 10)'), null=True, blank=True
|
||||
)
|
||||
custom_schema = JSONField(blank=True, default=dict)
|
||||
|
||||
title_type = models.CharField(
|
||||
|
|
Loading…
Reference in New Issue