Comments (3)
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.
Thank you!
from ls.joyous.
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)
- Suggestion: Sync with google HOT 2
- Make the Export functionality optional HOT 1
- FIRST_DAY_OF_WEEK doesn't work for monthly views HOT 3
- Docs on updating joyous HOT 3
- Upgrade - no calendar HOT 6
- Japanese translation HOT 3
- Issues trying to use Modeltranslation HOT 14
- Joyous EventBase.status field clashes with Django-Model-Utils StatusModel.status field HOT 5
- 'WSGIRequest' object has no attribute 'site' HOT 2
- Feature for setting multi time-ranges in same day HOT 4
- Not working properly with codredcms? HOT 2
- New Day view
- Merging events from two calendars... HOT 4
- Release 1.5.0 with default_auto_field set in JoyousAppConfig HOT 2
- Version 1.4.0 incompatible with holidays v0.13 HOT 7
- Saving events with same title fails
- Incompatible with Wagtail 3
- Joyous raises error with Django 3.2.17 Wagtail 2.16.3 and Python 3.9 HOT 1
- Wagtail 4.0 compatibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ls.joyous.