def _make_series(klass, form, **kwargs): series_data = DataBuilder.series_data_from_form(form) series_data.update(kwargs) klass._validate_series_data(series_data) series_data = klass._remove_none_fields(series_data) series = EventSeries(**series_data) series.save() return series
def _make_series(cls, form, **kwargs): """Create a new :class:`EventSeries` object and save it to Mongoengine. The event is made by creating ``series_data`` and then unpacking it into the constructor for :class:`EventSeries`. :param form: The WTForm form to fetch series data from. :type form: :class:`CreateEventForm` or a subclass. :param dict kwargs: Any other arguments that should be applied on top of the form data. :returns: The newly created series. :rtype: :class:`EventSeries` """ series_data = DataBuilder.series_data_from_form(form) series_data.update(kwargs) cls._validate_series_data(series_data) series_data = cls._remove_none_fields(series_data) series = EventSeries(**series_data) series.save() return series
def _make_series(klass, form, **kwargs): """Create a new :class:`EventSeries` object and save it to Mongoengine. The event is made by creating ``series_data`` and then unpacking it into the constructor for :class:`EventSeries`. :param form: The WTForm form to fetch series data from. :type form: :class:`CreateEventForm` or a subclass. :param dict kwargs: Any other arguments that should be applied on top of the form data. :returns: The newly created series. :rtype: :class:`EventSeries` """ series_data = DataBuilder.series_data_from_form(form) series_data.update(kwargs) klass._validate_series_data(series_data) series_data = klass._remove_none_fields(series_data) series = EventSeries(**series_data) series.save() return series