Giter Club home page Giter Club logo

Comments (3)

linuxsoftware avatar linuxsoftware commented on May 27, 2024

I am going to have to think about this. A check box to change the behaviour of individual events seems like it'd be quite complicated. (And we won't know the value of the checkbox until we have fetched the event.) Perhaps a new list of not-yet-finished events is needed that would return all events (single-day or multi-day, one-off or recurring) that have not finished. What would it be called? started-and-upcoming?

Meanwhile here is a monkey-patch that changes MultidayEventPage and MultidayEventQuerySet to work the way you want. Include this code somewhere like the models.py of one of your apps and it will change the behaviour of Joyous.

from ls.joyous.models.events import MultidayEventPage, MultidayEventQuerySet
from ls.joyous.utils.telltime import getLocalDatetime, todayUtc
from datetime import timedelta
from django.utils import timezone

def upcomingAndCurrent(self):
    qs = super(MultidayEventQuerySet, self).upcoming()
    return qs.filter(date_to__gte = todayUtc() - timedelta(1))
MultidayEventQuerySet.upcoming = upcomingAndCurrent

def upcomingFromDt(self):
    fromDt = getLocalDatetime(self.date_from, self.time_from, self.tz)
    toDt = getLocalDatetime(self.date_to, self.time_to, self.tz)
    return fromDt if toDt >= timezone.localtime() else None
MultidayEventPage._upcoming_datetime_from = property(upcomingFromDt)

Hope it helps. May contain bugs. No guarantee for future compatibility.

from ls.joyous.

lucasrohlf avatar lucasrohlf commented on May 27, 2024

Thank you!

from ls.joyous.

linuxsoftware avatar linuxsoftware commented on May 27, 2024

I have added a new setting JOYOUS_UPCOMING_INCLUDES_STARTED. If this is set to True then the list of upcoming events will also include events that have already started but have not yet finished.
This will be in the next release of Joyous (0.9.5).

from ls.joyous.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.