def save_al(list_): """Enregistrer les alertes qui sont dans la liste""" for el in list_: try: al = Alerte.filter(objets=el[0]).get() except: al = Alerte() al.objets = unicode(el[0]) al.date_a = el[1] al.status = True al.save()
def save_alerte(self): date_a = self.date_a.text() day, month, year = date_a.split("/") dt = datetime.now() datetime_ = datetime( int(year), int(month), int(day), int(dt.hour), int(dt.minute), int(dt.second), int(dt.microsecond) ) alt = Alerte() alt.objets = unicode(self.objets.toPlainText()) alt.date_a = datetime_ alt.save() self.cancel() raise_success(_(u"Confirmation"), _(u"The store has been changing"))