0001-misc-clear-validity-info-when-changing-feed-json-cel.patch
combo/data/models.py | ||
---|---|---|
1382 | 1382 |
def is_visible(self, **kwargs): |
1383 | 1383 |
return bool(self.url) and super(FeedCell, self).is_visible(**kwargs) |
1384 | 1384 | |
1385 |
def save(self, *args, **kwargs): |
|
1386 |
result = super().save(*args, **kwargs) |
|
1387 |
if 'update_fields' not in kwargs: |
|
1388 |
# always mark cell as valid when it is saved, it will be checked |
|
1389 |
# for real when it is rendered |
|
1390 |
self.mark_as_valid() |
|
1391 |
return result |
|
1392 | ||
1385 | 1393 |
def get_cell_extra_context(self, context): |
1386 | 1394 |
extra_context = super(FeedCell, self).get_cell_extra_context(context) |
1387 | 1395 | |
... | ... | |
1497 | 1505 |
class Meta: |
1498 | 1506 |
abstract = True |
1499 | 1507 | |
1508 |
def save(self, *args, **kwargs): |
|
1509 |
result = super().save(*args, **kwargs) |
|
1510 |
if 'update_fields' not in kwargs: |
|
1511 |
# always mark cell as valid when it is saved, it will be checked |
|
1512 |
# for real when it is rendered |
|
1513 |
self.mark_as_valid() |
|
1514 |
return result |
|
1515 | ||
1500 | 1516 |
def is_visible(self, **kwargs): |
1501 | 1517 |
return bool(self.url) and super(JsonCellBase, self).is_visible(**kwargs) |
1502 | 1518 |
tests/test_cells.py | ||
---|---|---|
332 | 332 |
assert validity_info.invalid_reason_code == 'data_url_invalid' |
333 | 333 |
assert validity_info.invalid_since is not None |
334 | 334 | |
335 |
# check validity info is cleared when the cell is saved |
|
336 |
cell.save() |
|
337 |
assert ValidityInfo.objects.exists() is False |
|
338 | ||
335 | 339 | |
336 | 340 |
def test_menu_cell(): |
337 | 341 |
Page.objects.all().delete() |
... | ... | |
614 | 618 |
cell.get_cell_extra_context(context) |
615 | 619 |
assert ValidityInfo.objects.exists() is True |
616 | 620 | |
621 |
# check validity info is cleared when the cell is saved |
|
622 |
cell.save() |
|
623 |
assert ValidityInfo.objects.exists() is False |
|
624 | ||
617 | 625 |
# url with two variables |
618 | 626 |
context['var2'] = 'bar' |
619 | 627 |
cell.varnames_str = 'var1, var2' |
620 |
- |