614 |
614 |
@classmethod
|
615 |
615 |
def import_json(cls, data):
|
616 |
616 |
data = clean_import_data(cls, data)
|
617 |
|
timeperiod, _ = cls.objects.update_or_create(defaults=data, **data)
|
618 |
|
return timeperiod
|
|
617 |
cls.objects.update_or_create(defaults=data, **data)
|
619 |
618 |
|
620 |
619 |
def export_json(self):
|
621 |
620 |
return {
|
... | ... | |
786 |
785 |
@classmethod
|
787 |
786 |
def import_json(cls, data):
|
788 |
787 |
data = clean_import_data(cls, data)
|
789 |
|
meeting_type, created = cls.objects.update_or_create(
|
790 |
|
slug=data['slug'], agenda=data['agenda'], defaults=data
|
791 |
|
)
|
792 |
|
return meeting_type
|
|
788 |
cls.objects.update_or_create(slug=data['slug'], agenda=data['agenda'], defaults=data)
|
793 |
789 |
|
794 |
790 |
def export_json(self):
|
795 |
791 |
return {
|
... | ... | |
977 |
973 |
)
|
978 |
974 |
data = clean_import_data(cls, data)
|
979 |
975 |
if data.get('slug'):
|
980 |
|
event, created = cls.objects.update_or_create(slug=data['slug'], defaults=data)
|
981 |
|
return event
|
|
976 |
cls.objects.update_or_create(slug=data['slug'], defaults=data)
|
|
977 |
return
|
982 |
978 |
event = cls(**data)
|
983 |
979 |
event.save()
|
984 |
|
return event
|
985 |
980 |
|
986 |
981 |
def export_json(self):
|
987 |
982 |
return {
|
... | ... | |
1171 |
1166 |
raise AgendaImportError(_('The unavailability calendar "%s" does not exist.') % slug)
|
1172 |
1167 |
desk.unavailability_calendars.add(target_calendar)
|
1173 |
1168 |
|
1174 |
|
return desk
|
1175 |
|
|
1176 |
1169 |
def export_json(self):
|
1177 |
1170 |
time_period_exceptions = self.timeperiodexception_set.filter(source__settings_slug__isnull=True)
|
1178 |
1171 |
time_period_exception_sources = self.timeperiodexceptionsource_set.filter(settings_slug__isnull=False)
|
... | ... | |
1514 |
1507 |
source, _ = cls.objects.update_or_create(**data)
|
1515 |
1508 |
if source.enabled:
|
1516 |
1509 |
source.enable()
|
1517 |
|
return source
|
1518 |
1510 |
|
1519 |
1511 |
def export_json(self):
|
1520 |
1512 |
'''Export only sources from settings.'''
|
... | ... | |
1606 |
1598 |
exception['unavailability_calendar'] = unavailability_calendar
|
1607 |
1599 |
TimePeriodException.import_json(exception)
|
1608 |
1600 |
|
1609 |
|
return created
|
1610 |
|
|
1611 |
1601 |
|
1612 |
1602 |
class TimePeriodException(models.Model):
|
1613 |
1603 |
desk = models.ForeignKey(Desk, on_delete=models.CASCADE, null=True)
|
... | ... | |
1695 |
1685 |
data = clean_import_data(cls, data)
|
1696 |
1686 |
query_data = data.copy()
|
1697 |
1687 |
query_data.pop('update_datetime')
|
1698 |
|
exception, _ = cls.objects.update_or_create(defaults=data, **query_data)
|
1699 |
|
return exception
|
|
1688 |
try:
|
|
1689 |
cls.objects.update_or_create(defaults=data, **query_data)
|
|
1690 |
except cls.MultipleObjectsReturned:
|
|
1691 |
cls.objects.filter(**query_data).update(update_datetime=data['update_datetime'])
|
1700 |
1692 |
|
1701 |
1693 |
def export_json(self):
|
1702 |
1694 |
def export_datetime(dt):
|
... | ... | |
1847 |
1839 |
def import_json(cls, data):
|
1848 |
1840 |
data = clean_import_data(cls, data)
|
1849 |
1841 |
agenda = data.pop('agenda')
|
1850 |
|
notification_settings, created = cls.objects.update_or_create(agenda=agenda, defaults=data)
|
1851 |
|
return notification_settings
|
|
1842 |
cls.objects.update_or_create(agenda=agenda, defaults=data)
|
1852 |
1843 |
|
1853 |
1844 |
def export_json(self):
|
1854 |
1845 |
return {
|
... | ... | |
1908 |
1899 |
def import_json(cls, data):
|
1909 |
1900 |
data = clean_import_data(cls, data)
|
1910 |
1901 |
agenda = data.pop('agenda')
|
1911 |
|
reminder_settings, created = cls.objects.update_or_create(agenda=agenda, defaults=data)
|
1912 |
|
return reminder_settings
|
|
1902 |
cls.objects.update_or_create(agenda=agenda, defaults=data)
|
1913 |
1903 |
|
1914 |
1904 |
def export_json(self):
|
1915 |
1905 |
return {
|