def Done(request, unique_id): day = datetime.date.today().day month = datetime.date.today().month year = datetime.date.today().year obj = Lauxilary.get_activity_object(unique_id) obj.last_occurence = int(Lauxilary.date_to_integer(day, month, year)) obj.save() return HttpResponseRedirect('/L/#about')
def LIndex(request): day = datetime.date.today().day month = datetime.date.today().month year = datetime.date.today().year today = {"day": day, "month": month, "year": year} Welcome_phrase = generate_welcome() Dailystuff = get_all_of_the_day() active_flrp, active_repeat, active_reminder, active_deadline, active_daily = Lauxilary.give_all_active( ) template = loader.get_template('Lindex.html') open_desc = models.Descision.objects.filter(silencedyorN="N") context = { "Welcome": Welcome_phrase, "Quote": Dailystuff[0], "flrp": active_flrp, "repe": active_repeat, "remi": active_reminder, "dead": active_deadline, "vid": Dailystuff[1], "today": today, "article": Dailystuff[2], "daily": active_daily, "desc": open_desc } return TemplateResponse(request, template, context)
def Donerep(request, unique_id): day = datetime.date.today().day month = datetime.date.today().month year = datetime.date.today().year obj = models.repeat.objects.get(unique_id=unique_id) obj.last_occurence = str(Lauxilary.date_to_integer(day, month, year)) obj.save() return HttpResponseRedirect('/L/#about')
def More(request, unique_id): obj = Lauxilary.get_activity_object(unique_id) if str(unique_id)[0:2] == "04": template = loader.get_template('Mored.html') context = {"obj": obj} return TemplateResponse(request, template, context) else: template = loader.get_template('More.html') context = {"obj": obj} return TemplateResponse(request, template, context)
def Editproperties(request, unique_id): cur = Lauxilary.get_activity_object(unique_id) if request.method == 'POST': form = dead(request.POST) description = cur.description month = form['month'].value() day = form['day'].value() warning = form['warning'].value() #description, deadday, deadtime, warningtime cur.__adddead__(description, day, month, int(warning)) return HttpResponseRedirect('/L/more/%s' % unique_id)
def Editdescription(request, unique_id): obj = Lauxilary.get_activity_object(unique_id) code = unique_id[0:2] if request.method == 'POST': form = Description(request.POST) description = str(form['description'].value()) if code == "03": obj.text = description obj.save() else: obj.description = description obj.save() return HttpResponseRedirect('/L/more/%s' % unique_id)
def get_all_of_the_day(): if not 'last_daily_day' in globals(): last_daily_day = 0 global last_daily_day today = datetime.date.today() day = today.day month = today.month year = today.year int_day = Lauxilary.date_to_integer(day, month, year) if not 'Daily' in globals() or int(last_daily_day) != int(int_day): # pick new ones Allquotes = models.Quote.objects.filter(silencedyorN="N") Dayquote = random.sample(Allquotes, 1)[0] Video = models.Video.objects.filter(silenced="N") Dayvideo = random.sample(Video, 1)[0] Articles = models.Article.objects.filter(silenced="N") Dayarticle = random.sample(Articles, 1)[0] last_daily_day = int_day global last_daily_day Daily = [Dayquote, Dayvideo, Dayarticle] global Daily return Daily
def Delofficial(request, unique_id): cur = Lauxilary.get_activity_object(unique_id) cur.delete() return HttpResponseRedirect('/L/showalldescisions')
def Delete(request, unique_id): obj = Lauxilary.get_activity_object(unique_id) obj.silencedyorN = "y" obj.save() return HttpResponseRedirect('/L/#about')